Re: Bar Plot

Added by Piyush over 2 years ago

Hello everyone...

I want to plot bar and line plot together. There are both positive and negative values available for line plot whereas bar plot contains only positive values.

Now when I will plot line plot it draws a line in both quadrants but when I am plotting bar plot it should plot from 0 instead of last negative value.

So how one can start plotting bar graph from 0 instead of negative? and how one can plot multiple bars for a single x-axis value?

Please help me in this regards

Thank you in advance

rain-fre.ps (25 KB)


Replies (5)

RE: Re: Bar Plot - Added by Paul over 2 years ago

Hi Piyush, per the psxy documentation it says the default base of bars is y_min but you can change this:

-Sb[size[c|i|p|u]][+b[base]]
Vertical bar extending from base to y. The size is bar width. Append u if size is in x-units [Default is plot-distance units]. By default, base = ymin. Append +b[base] to change this value. If base is not appended then we read it from the last input data column. Use +B[base] if the bar height is measured relative to base [Relative to origin].

So I guess you want +b0

RE: Re: Bar Plot - Added by Piyush over 2 years ago

Thank you Paul...

It is working for me...

Additionally, Sb<value>ub<base value> is working, too.

Thank you

RE: Re: Bar Plot - Added by Lavanya 11 months ago

Hi,

I want a bar plot quite similar to your attachment. The base of the vertical bar plot need to be referenced to zero.
I used -Sb0.4+b0, where -Sb0.4 refer to the size of the vertical plot and +b0 for the base to 0. This does not work.
Do you know how to draw vertical bar with reference to a base at zero. Please see the input file for reference.

Thank you.

gulkana.txt Magnifier (193 Bytes)

RE: Re: Bar Plot - Added by Paul 11 months ago

This works fine for me

gmt psxy -R2000/2017/-2500/100 -JX6i gulkana.txt -Sb0.2i+b0 -Gred -Baf > t.ps

RE: Re: Bar Plot - Added by Lavanya 11 months ago

Thank you so much for the reply.

It did give me a warning,
psxy: Warning: 0.2i+ not a valid number and may not be decoded properly.

I used -Sb0.4b0 and it worked. I am using GMT 5.4.4 version.

-
Lavanya

(1-5/5)