f



Changing x-axis plot from right to left to left to right

Hi, 
For mathematical reasons, I need to change the way that gnuplots my data along the X axis from right to left to left to right (that is, at the minute it plots from 20 down to 1, not from 1 to 20)

I am aware of set xrange reverse but this just inverts the whole graph and displays from 17 .... 1 down along the x-axis rather than plotting the other way round. 

I'm rather stuck and would appreciate some advice. 

Regards

Jamie
0
Jamie
8/14/2012 3:52:44 PM
comp.graphics.apps.gnuplot 5008 articles. 0 followers. Post Follow

5 Replies
1330 Views

Similar Articles

[PageSpeed] 2

On 14.08.2012 17:52, Jamie Rees wrote:

> For mathematical reasons, I need to change the way that gnuplots my
> data along the X axis from right to left to left to right (that is,
> at the minute it plots from 20 down to 1, not from 1 to 20)

That makes no sense whatsoever.  gnuplot generates some kind of picture. 
  It makes absolutely no difference whatsoever whether a line was drawn 
from left to right or right to left --- it'll be the same line in the 
end, consisisting of exactly the same pixels being coloured.

So since this doesn't make sense, maybe you should tell us what your 
actual problem is, so we can find out how that might be solved.
0
ISO
8/14/2012 5:12:33 PM
On Tuesday, August 14, 2012 6:12:33 PM UTC+1, Hans-Bernhard Br=F6ker wrote:
> On 14.08.2012 17:52, Jamie Rees wrote:
>=20
>=20
>=20
> > For mathematical reasons, I need to change the way that gnuplots my
>=20
> > data along the X axis from right to left to left to right (that is,
>=20
> > at the minute it plots from 20 down to 1, not from 1 to 20)
>=20
>=20
>=20
> That makes no sense whatsoever.  gnuplot generates some kind of picture.=
=20
>=20
>   It makes absolutely no difference whatsoever whether a line was drawn=
=20
>=20
> from left to right or right to left --- it'll be the same line in the=20
>=20
> end, consisisting of exactly the same pixels being coloured.
>=20
>=20
>=20
> So since this doesn't make sense, maybe you should tell us what your=20
>=20
> actual problem is, so we can find out how that might be solved.

I'm using gnuplot in conjunction with a dotNet application which has a SQL =
Server backend. I am plotting data stored on the SQL Server.

I need to be able to manipulate the data being plotted on the graph. I need=
 to be able to draw a line which steps down from left to right,  when the d=
ata may include peaks and troughs which would otherwise mean the graph woul=
d go up and down.=20

I've worked out that I can do this is I check to see whether if the previou=
s next value along is higher than the previous, and if it is, assume the va=
lue of the previous and then plot a straight line.=20

Make much sense?
Thanks

Jamie
0
Jamie
8/16/2012 3:33:49 PM
On 16.08.2012 17:33, Jamie Rees wrote:

> I need to be able to manipulate the data being plotted on the graph.

So what does the direction of plotting have to do with that?

If you want to plot data that's different from the actual one you pulled 
out of your database, what keeps you from doing so in the program that 
sits between the DB and gnuplot?

> I need to be able to draw a line which steps down from left to right,
> when the data may include peaks and troughs which would otherwise
> mean the graph would go up and down.

That sounds like you might be talking about a monotonically falling 
smallest upper bound of the actual data, but I'm afraid you lost me 
halfway along that sentence.

> I've worked out that I can do this is I check to see whether if the
> previous next value along is higher than the previous, and if it is,
> assume the value of the previous and then plot a straight line.

I guess you meant "horizontal line" there.

> Make much sense?

Frankly?  No.

0
ISO
8/16/2012 8:17:39 PM
Jamie Rees wrote:

> On Tuesday, August 14, 2012 6:12:33 PM UTC+1, Hans-Bernhard Bröker wrote:
>> On 14.08.2012 17:52, Jamie Rees wrote:
>>  
>> > For mathematical reasons, I need to change the way that gnuplots my
>> > data along the X axis from right to left to left to right (that is, 
>> > at the minute it plots from 20 down to 1, not from 1 to 20)

gnuplot plots points in the order they arrive in.
left-to-right, right-to-left, or non-monotonic ordering on x is 
totally irrelevant.


>> So since this doesn't make sense, maybe you should tell us what your 
>> actual problem is, so we can find out how that might be solved.
> 
> I need to be able to manipulate the data being plotted on the graph. I
> need to be able to draw a line which steps down from left to right,  when
> the data may include peaks and troughs which would otherwise mean the
> graph would go up and down.

If you meant the each point is only plotted if it is lower than previous
points, then the following command would do the trick:

  cap = SOME_VERY_BIG_NUMBER
  plot foo using 1:( $2 > cap ? cap : cap=$2 ) with lines

or if you want to leave a gap where the limiting cap was triggered

  plot foo using 1:( $2 > cap ? NaN : cap=$2 ) with lines

 
> I've worked out that I can do this is I check to see whether if the
> previous next value along is higher than the previous, and if it is,
> assume the value of the previous and then plot a straight line.
> 
> Make much sense?
> Thanks
> 
> Jamie

0
sfeam
8/16/2012 9:01:09 PM
Ah I see now - thanks. I did assume it was a gnuplot problem but actually an issue with an SQL statement. I've got another issue now, but I'll post that in a seperate thread.

Thanks,

Jamie
0
Jamie
9/7/2012 9:42:51 AM
Reply: