|
From: <lyn...@fr...> - 2010-09-13 19:56:42
|
Hello! How can I plot a function with two different y-axes? Eg. a histogram and on one y-axis its absulte counts per cluster and on the other the relative values of each cluster. Is it possible to have gnuplot calculate the range for the second y-axis depending on the range it chooses for the first y-axis? Thanks for any help or hints Lynx |
|
From: <lyn...@fr...> - 2010-09-16 16:15:14
|
Hello! Since there hasn't been any reply to my last post I'll try to make the problem more clear: A histogram can be plotted with absolut values on the y-axis or with relative (normalized) values on the y-axis. I'm looking for a way to combine the two. I've problems though because the re- plotting of the data to get the scales on the y2 axis yields normally a second plot that is not incident with the first (see attached hist, green and red). Since the shape of the histogram is the same this looks very confusing and redundant. Is there a way to - either plot a y2-range with a functional dependence on the range gnuplot chose for plotting on the y-axis? - or is there a way to plot the same data again using the y2 axis but having both plots coincide? Thanks for any help or hints Lynx On 13/09/10 21:56:33, lyn...@fr... wrote: > Hello! > > > How can I plot a function with two different y-axes? Eg. a histogram and on > one y-axis its absulte counts per cluster and on the other the relative values > of each cluster. > Is it possible to have gnuplot calculate the range for the second y-axis > depending on the range it chooses for the first y-axis? > > Thanks for any help or hints > Lynx > > > ------------------------------------------------------------------------------ > Start uncovering the many advantages of virtual appliances > and start using them to simplify application deployment and > accelerate your shift to cloud computing > http://p.sf.net/sfu/novell-sfdev2dev > _______________________________________________ > gnuplot-info mailing list > gnu...@li... > https://lists.sourceforge.net/lists/listinfo/gnuplot-info |
|
From: Thomas S. <t.s...@fz...> - 2010-09-16 19:18:24
|
you need a dummy plot to get the yrange first (unless you set it by hand). then you set y2range using the internal variables GPVAL_Y_MAX, GPVAL_DATA_Y_MAX, ... an example: the data file 'ts.dat' looks like this: 95 210 321 198 103 script for normalizing relative to the highest histogram bar: set style data histogram set style fill solid set yrange [0:*] set term push set term dumb plot for [COL=1:5] 'ts.dat' using COL notitle set term pop set ytics nomirror set y2tics set y2range [0:GPVAL_Y_MAX/GPVAL_DATA_Y_MAX] plot for [COL=1:5] 'ts.dat' using COL notitle script for normalizing to the total sum of the cluster: set style data histogram set style fill solid set yrange [0:*] set term push set term dumb sum = 0 plot for [COL=1:5] 'ts.dat' us (sum=sum+column(COL),column(COL)) set term pop set ytics nomirror set y2tics set y2range [0:GPVAL_Y_MAX/sum] plot for [COL=1:5] 'ts.dat' using COL notitle lynx.abraxas wrote: > > Hello! > > > Since there hasn't been any reply to my last post I'll try to make the > problem > more clear: > > A histogram can be plotted with absolut values on the y-axis or with > relative > (normalized) values on the y-axis. > I'm looking for a way to combine the two. I've problems though because the > re- > plotting of the data to get the scales on the y2 axis yields normally a > second > plot that is not incident with the first (see attached hist, green and > red). > Since the shape of the histogram is the same this looks very confusing > and > redundant. > > Is there a way to > - either plot a y2-range with a functional dependence on the range > gnuplot > chose for plotting on the y-axis? > - or is there a way to plot the same data again using the y2 axis but > having > both plots coincide? > > Thanks for any help or hints > Lynx > > > On 13/09/10 21:56:33, lyn...@fr... wrote: >> Hello! >> >> >> How can I plot a function with two different y-axes? Eg. a histogram >> and on >> one y-axis its absulte counts per cluster and on the other the relative >> values >> of each cluster. >> Is it possible to have gnuplot calculate the range for the second >> y-axis >> depending on the range it chooses for the first y-axis? >> >> Thanks for any help or hints >> Lynx >> >> >> ------------------------------------------------------------------------------ >> Start uncovering the many advantages of virtual appliances >> and start using them to simplify application deployment and >> accelerate your shift to cloud computing >> http://p.sf.net/sfu/novell-sfdev2dev >> _______________________________________________ >> gnuplot-info mailing list >> gnu...@li... >> https://lists.sourceforge.net/lists/listinfo/gnuplot-info > > ------------------------------------------------------------------------------ > Start uncovering the many advantages of virtual appliances > and start using them to simplify application deployment and > accelerate your shift to cloud computing. > http://p.sf.net/sfu/novell-sfdev2dev > _______________________________________________ > gnuplot-info mailing list > gnu...@li... > https://lists.sourceforge.net/lists/listinfo/gnuplot-info > > -- View this message in context: http://old.nabble.com/One-fuction-with-two-different-y-axes--tp29702270p29732093.html Sent from the Gnuplot - User mailing list archive at Nabble.com. |
|
From: <lyn...@fr...> - 2010-10-20 07:31:51
|
On 16/09/10 12:18:17, Thomas Sefzick wrote: > > you need a dummy plot to get the yrange first (unless > you set it by hand). then you set y2range using the internal > variables GPVAL_Y_MAX, GPVAL_DATA_Y_MAX, ... Thanks a lot Thomas! It works great with GPVAL_Y_MAX, GPVAL_DATA_Y_MAX. Though I came to another problem now: When using the kdensity smoothing the automatically chosen y-range is often trice as large as the maximum of the plot. Is there a way to make gnuplot automatically optimize the y-scaling in such a case? Setting it by hand wouldn't be data independent. Thanks for any help or hints. Lynx |