SourceForge logo
SourceForge logo
Menu

matplotlib-users

From: mdekauwe <mde...@gm...> - 2013年06月29日 06:44:06
Hi,
I am plotting overlapping bars in a bar chart. In some places one bar
overlaps the other so I would like to draw a horizontal line to show where
the underlying bar extends to. My plots are postscripts so I can't use
alpha. The only way I could come up with involves me figuring out by trial
and error where each bar starts, for example:
bar_width = 0.068
xmin_line = 0.198
xmax_line = xmin_line+bar_width
plt.axhline(y=data_biomass[2], xmin=xmin_line, xmax=xmax_line, linewidth=2,
color="b")
Is there a way I can work out where each bar starts and how wide it is? I
tried ax.get_xticks, but these don't match with the above function which
only seems to be a fraction of 0 - 1.
thanks,
Martin
 
--
View this message in context: http://matplotlib.1069221.n5.nabble.com/drawing-horizontal-line-on-bar-chart-tp41333.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: Benjamin R. <ben...@ou...> - 2013年06月29日 21:17:08
This kind of sounds like stack plots, but I am not quite sure.
Cheers!
Ben Root
On Jun 29, 2013 1:45 AM, "mdekauwe" <mde...@gm...> wrote:
> Hi,
>
> I am plotting overlapping bars in a bar chart. In some places one bar
> overlaps the other so I would like to draw a horizontal line to show where
> the underlying bar extends to. My plots are postscripts so I can't use
> alpha. The only way I could come up with involves me figuring out by trial
> and error where each bar starts, for example:
>
> bar_width = 0.068
> xmin_line = 0.198
> xmax_line = xmin_line+bar_width
> plt.axhline(y=data_biomass[2], xmin=xmin_line, xmax=xmax_line, linewidth=2,
> color="b")
>
> Is there a way I can work out where each bar starts and how wide it is? I
> tried ax.get_xticks, but these don't match with the above function which
> only seems to be a fraction of 0 - 1.
>
> thanks,
>
> Martin
>
>
>
>
> --
> View this message in context:
> http://matplotlib.1069221.n5.nabble.com/drawing-horizontal-line-on-bar-chart-tp41333.html
> Sent from the matplotlib - users mailing list archive at Nabble.com.
>
>
> ------------------------------------------------------------------------------
> This SF.net email is sponsored by Windows:
>
> Build for Windows Store.
>
> http://p.sf.net/sfu/windows-dev2dev
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
From: mdekauwe <mde...@gm...> - 2013年06月30日 01:36:34
Yes and no. My understanding of stacked bars is the bar stacked on top is
always larger than the one below. I am trying to show how much the second
bar explains of the first bar. In my case though it is possible the second
bar is larger than the first. As a consequence you wouldn't see both bars
and this is why I want to draw a line to show where the other bar extends
to.the 
--
View this message in context: http://matplotlib.1069221.n5.nabble.com/drawing-horizontal-line-on-bar-chart-tp41333p41341.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.
Thanks for helping keep SourceForge clean.
X





Briefly describe the problem (required):
Upload screenshot of ad (required):
Select a file, or drag & drop file here.
Screenshot instructions:

Click URL instructions:
Right-click on the ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)

More information about our ad policies

Ad destination/click URL:

AltStyle によって変換されたページ (->オリジナル) /