Page 1 of 1
Can I setup the same values on both axes of a graph?
Posted: Thu Jun 19, 2008 3:32 pm
by wfpost
Hi,
is there a switch that allows to have same values on the left and right axis of a graph.
e.g. the graph attached showing the wind.
I´d like to have the same values for both axes
I want the right axis using the same values as the left one for the first sensor .
The manual setting of minmum/maximum in the settings menu is not suitable as long I have to use fixed numbers there.
Only helpful if I could enter there some variable like (max. value of sensor x + 1) and not a fixed value which leaves the graph to small or too large:(
Thanks,
Wolfgang

Re:Can I setup the same values on both axes of a graph?
Posted: Thu Jun 19, 2008 7:33 pm
by admin
You can do that by making use of the gnuplot format command feature
set y2tics mirror
copies the tics and numbers from the left y-axis to the right.
set format y2 "%.1f °C"
sets the format string for the numbers on the right y-axis.
Re:Can I setup the same values on both axes of a graph?
Posted: Thu Jun 19, 2008 7:37 pm
by admin
This is the result

Re:Can I setup the same values on both axes of a graph? ** s
Posted: Fri Jun 20, 2008 2:03 pm
by wfpost
Thanks, but because I want two different display types that won´t do it for me.
Can I set the maximum value of both y-axes dependant on the sensor value in a given period?
Let´s say my maximum current temp. is 24°C.
Is there a format command allowing me to set the maximum value of the y-axis to like 24+2, where 24 is a variable and not fix, because it depends on the current numbers the sensor is sending?
In other words, is there a possibility to set the maximum value of the y-axis depending on the variable maximums as a function from x?
That would be great.
Cheers,
Wolfgang

Re:Can I setup the same values on both axes of a graph? ** s
Posted: Fri Jun 20, 2008 2:13 pm
by wfpost
maybe the attached graph explains why I want that.
Sometimes the two graphs are out of synch, because the two y-axes have different maximums. I want them to be the same.

Re:Can I setup the same values on both axes of a graph? ** s
Posted: Fri Jun 20, 2008 4:29 pm
by admin
From my point of view the mirror thing just makes sense when both curves are defined for the same axis (both on the left as in my example). Normally the right y-axis is just making sense when you have another measurement unit to draw a graph for.
I don't know of a gnuplot command that can set y ranges dependent from maximum values in the graph.
Re:Can I setup the same values on both axes of a graph? ** s
Posted: Mon Jul 28, 2008 9:15 pm
by sevenless
While creating some graphs for my station, I stumbled upon a "cheat" for fixing this graph problem.
For multi-line graphs, imagine that GNUplot draws a series of single-line graphs and then stacks them atop each other to produce the final result. Before the drawing begins, meteohub provides information to the program telling it where to set the minimum and maximum for that axis, and the plotting program uses that information to set the axis for ALL graphs drawn on that side.
Because GNUplot draws lines in sequential order on each graph, this means for certain graph types (bars and impulses), "higher" information often ends up covering up "lower" information. Normally this is a problem, but in this case it provides the solution.
On the left Y-axis, first select th0-max, and give that bar a white color (#ffffff). Then in the second row select the data you are interested in (th0) and give it the red color (see image.)
When you generate the graph, the white data (th0-max) disappears into the background and is unseen, but it provides the needed information to make the values of the left y-axis match the right y-axis and your graph will display correctly!
This trick
should work for most graph types. The important thing to remember is that graph lines are drawn sequentially -- first the left y-axis graphs from top to bottom, and then the right y-axis graphs from top to bottom.
Re:Can I setup the same values on both axes of a graph?
Posted: Tue Jul 29, 2008 8:11 pm
by wfpost
Nice find, sevenless. Thanks for posting that trick. Already applied it on my website!
Re:Can I setup the same values on both axes of a graph?
Posted: Fri Feb 12, 2010 1:16 pm
by zitterbacke
Hi,
can anybody help me with the correct syntax, if the values are %-values? Temperature values are no problem, here the command works fine. But to get %-values to the second y-axis I have a serious problem...
Thanks in advance.
Jens.