y = x^2 and y = (x-3)^2 and y = x^2 + 5
Is there a way to stretch or shift a graph by grabbing it with the
mouse? My graphing calculator does this. (I know that I can just
graph all of the above functions on one graph, and that's pretty
good.)
Also, a question about zooming. I have found the rectangle-select by
right clicking and then left clicking. Is there a way to "zoom in"
without choosing a rectangle? More importantly (because the rectangle-
select can't do this), is there a zoom-out?
If I specify a range on the "plot" line, then I can't zoom at all.
plot [-10:10] [5:5] x**2
Does this mean that if I want to zoom, I should specify the range on a
separate line?
set xrange [-10:10]
In general, gnuplot doesn't seem to be built for interactivity. For
example, if I graph 3 graphs, and then decide I only want to view 2 of
them, I have to delete it from the command line. If I change some
parameters in those 2, and then want to add back the 3rd graph,
there's no "checkbox" for this. I'd have to cut/paste its formula.
Also, it would be nice if the ranges were textboxes that I could
change more easily, instead of typing
set xrange [-9:9]
Should I be using a different graphing package, for my tutoring? Or
is there a better GUI available for gnuplot? I'm using wgnuplot.exe .
Finally, where is there documentation for what commands are available
when the focus is on the graph window? I have discovered that
pressing 'q' closes the window. I'd prefer to keep it open, so I use
Alt-Tab to get back to the command window. Is there a single key I
can press instead? Also, I only discovered the right-click to zoom
feature by trial and error. Can I get a list of all keyboard
shortcuts for the graphing window? I tried F5 for Replot, but it
doesn't work...
Thanks.
Take a look at maxima and its gui wxmaxima, although it might be overkill
for what you're doing.
http://maxima.sourceforge.net/
http://wxmaxima.sourceforge.net/wiki/index.php/Main_Page
http://wxmaxima.sourceforge.net/wiki/index.php/Screenshots
It uses gnuplot at the back end.
Cheers,
Peter
Press 'h' while the plot window is active to see the available keys
and their effects.
To answer your question, gnuplot *is* designed for interactivity, but
perhaps not the kind of interactivity that you want. One of the
primary use cases for gnuplot is exploratory data analysis, that is,
where the user types commands at the command line to see some aspect
of his data plotted, then tweaks the commands to look at some other
aspect etc.
If you want to do a classroom presentation, then maybe you should look
somewhere else, especially if you want a GUI with shiny sliders,
checkboxes and functions that can be grabbed and rescaled.
That said, you can still use gnuplot for a sort of an interactive
presentation. The 'bind' command lets you assign key combinations to
arbitrary sequences of commands, which can then be executed by
pressing their corresponding keys.
For example, you can do
bind z "plot x**2, (x-3)**2, x**2+5"
bind y "plot x**2, (x-3)**2"
bind x "plot x**2"
Then you can just press the keys in order (x, y, z) to see the 3
functions plotted in sequence.
Péter Juhász
Thanks. 'h' helped, and 'bind' is neat for preparing a presentation.
Pressing SPACE had no effect for me, because I didn't have overlapping
windows. :-) (It brings the command window to the front, but doesn't
give it focus.)
I still think zooming similar to Google Maps should be included. I
just mean pressing + or - to zoom in or out. Gnuplot already has
zooming capability, and even the more-difficult rectangle-zooming.
Also, as I mentioned, I don't see why it locks the zoom level when I
specify the zoom level on the 'plot' line. (It ignores any subsequent
zooming commands.)
plot [-10:10] [5:5] x**2
geep: I'll take a look at maxima.
That must be some Windows-specific thing. I can't help there.
> I still think zooming similar to Google Maps should be included. I
> just mean pressing + or - to zoom in or out. Gnuplot already has
> zooming capability, and even the more-difficult rectangle-zooming.
Current gnuplot has zooming and panning using the mouse scroll wheel:
scroll = up/down pan
shift-scroll = left/right pan
ctrl-scroll = zoom/unzoom
But this may not be supported in the version you have, or maybe the
Windows terminal doesn't do this?
> Also, as I mentioned, I don't see why it locks the zoom level when I
> specify the zoom level on the 'plot' line. (It ignores any subsequent
> zooming commands.)
> plot [-10:10] [5:5] x**2
That is because the zoom command is implemented by setting a new range
and then re-executing the plot command. But if the plot command itself
restores the original range, then nothing useful happens. I recommend
against putting ranges in the plot command, both for this reason and
because it similarly prevents you from manually adjusting the range and
typing "replot" from the console.
It works for me for years.
> > I still think zooming similar to Google Maps should be included. I
> > just mean pressing + or - to zoom in or out. Gnuplot already has
> > zooming capability, and even the more-difficult rectangle-zooming.
>
> Current gnuplot has zooming and panning using the mouse scroll wheel:
> scroll = up/down pan
> shift-scroll = left/right pan
> ctrl-scroll = zoom/unzoom
Yes, this mouse wheel zooming works fine in the current development version.
Otherwise, you can bind '+' and '-' (and put them into .gnuplotrc or
gnuplot.ini) to something like:
bind '+' 'dx=GPVAL_X_MAX-GPVAL_X_MIN; set xrange [GPVAL_X_MIN-dx:GPVAL_X_MAX+dx]; replot'
---
PM
> That is because the zoom command is implemented by setting a new range
> and then re-executing the plot command. But if the plot command itself
Really? But why are the borders and tics and labels zoomed as well?
Currently, at least in X11, mouse zooming makes the plot expand beyond
the canvas, partly leading to some nasty effects like arrows
disappearing at high zoom levels etc.
Indeed, a frame-preserving zoom that just affects the x/y/zrange (and
thus the tics and tic labels), but keeps the borders within the window,
would be a nice feature or option for zooming.
Ingo
> On 13.01.2011 04:53, sfeam wrote:
>
>> That is because the zoom command is implemented by setting a new range
>> and then re-executing the plot command. But if the plot command itself
>
> Really?
Yes, really.
The code in mouse.c: apply_zoom() does
sprintf(s, "set xr[%.12g:%.12g]; set yr[%.12g:%.12g]",
zoom_now->xmin, zoom_now->xmax, ...
...
do_string_replot(s);
> But why are the borders and tics and labels zoomed as well?
> Currently, at least in X11, mouse zooming makes the plot expand beyond
> the canvas, partly leading to some nasty effects like arrows
> disappearing at high zoom levels etc.
I don't understand the question.
If arrows disappear, it is probably because of the setting for
the clipping behaviour. You can choose whether partial line segments
appear in the plot or not by changing the value of "set clip".
> Indeed, a frame-preserving zoom that just affects the x/y/zrange (and
> thus the tics and tic labels), but keeps the borders within the window,
> would be a nice feature or option for zooming.
Oh, wait a minute. Are you now talking about 3D plots?
I thought the original question was about 2D plotting.
The reason that borders, etc, are allowed to go off-screen during
3D manipulation is to avoid having the plot "pulsate" as you
rotate it. That is, we don't want the scale to change as you
rotate the view angle interactively.
Ethan
>
> Ingo
> Oh, wait a minute. Are you now talking about 3D plots?
Yes, I am talking about the smooth mouse-zoom for which I had provided a
log-scale patch some time ago. I noticed that arrows could disappear at
high (>~10x) zoom levels.
I have solar system plots (using data from the JPL HORIZONS database)
where arrows are used to create arbitrary grids in space (e.g. the
ecliptic or the equatorial plane, surface tangent plane etc.). Since it
allows scaling about several orders of magnitude, one wants to do quick
zooming from Eris or Sedna orbital scale down to the orbits of the
terrestrial planets.
> The reason that borders, etc, are allowed to go off-screen during
> 3D manipulation is to avoid having the plot "pulsate" as you
> rotate it. That is, we don't want the scale to change as you
> rotate the view angle interactively.
What I have in mind would be some additional interactive zooming that
changes the scale. This would be an option, not a replacement for the
current all-on-one zoom (which also has its benefits, e.g. for best
fitting the plot in the window). It is, however, just a "wanna have",
not a really required feature, so don't bother about that for now.
A very nice (but probably also very non-trivial) thing would, of course,
be a real perspective 3D mode, i.e. where more distant parts are smaller
then close-by ones. This would help to get rid of the
foreground-background ambiquity that sometimes occurs in the present
mode. I wonder whether that idea has ever been discussed.
Ingo
> Am 2011-01-14 19:48, schrieb sfeam:
>
>> Oh, wait a minute. Are you now talking about 3D plots?
>
> Yes, I am talking about the smooth mouse-zoom for which I had provided a
> log-scale patch some time ago. I noticed that arrows could disappear at
> high (>~10x) zoom levels.
>
> I have solar system plots (using data from the JPL HORIZONS database)
> where arrows are used to create arbitrary grids in space (e.g. the
> ecliptic or the equatorial plane, surface tangent plane etc.). Since it
> allows scaling about several orders of magnitude, one wants to do quick
> zooming from Eris or Sedna orbital scale down to the orbits of the
> terrestrial planets.
>
>> The reason that borders, etc, are allowed to go off-screen during
>> 3D manipulation is to avoid having the plot "pulsate" as you
>> rotate it. That is, we don't want the scale to change as you
>> rotate the view angle interactively.
>
> What I have in mind would be some additional interactive zooming that
> changes the scale. This would be an option, not a replacement for the
> current all-on-one zoom (which also has its benefits, e.g. for best
> fitting the plot in the window). It is, however, just a "wanna have",
> not a really required feature, so don't bother about that for now.
There's control-mousewheel in the CVS version.
It compresses or expands xrange and yrange without otherwise changing
the orientation of scale of the plot borders.
Ethan
> There's control-mousewheel in the CVS version.
> It compresses or expands xrange and yrange without otherwise changing
> the orientation of scale of the plot borders.
Ah thanks, I didn't know that it was already there.
Ingo
Wouldn't simple parametric planes defined in the plot command be
better for this purpose? Or even simpler, planes in their z = A*x +
B*y + C form, where A,B,C can easily be derived from the appropriate
orbital elements.
>
> A very nice (but probably also very non-trivial) thing would, of course,
> be a real perspective 3D mode, i.e. where more distant parts are smaller
> then close-by ones. This would help to get rid of the
> foreground-background ambiquity that sometimes occurs in the present
> mode. I wonder whether that idea has ever been discussed.
Might have been mentioned on the developers' list a few (hundred)
times :)
There is even an old patch for this on Sourceforge, but it doesn't
work anymore on recent gnuplot versions.
Péter Juhász
>
> Ingo
Current gnuplot has zooming and panning using the mouse scroll wheel:
scroll = up/down pan
shift-scroll = left/right pan
ctrl-scroll = zoom/unzoom
I have just update my cvs version of gnuplot for windows binary
distributions.
http://www.tatsuromatsuoka.com/gnuplot/Eng/winbin/
Regards
Tatsuro