New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding orders of magnitude to fractional values in plot_bar_stacked #43
Comments
Hi @magruca It looks like percent formatting is working as expected (see screenshot below). Percents are expected to be expressed as decimals with 0.0 - 1.0 mapping to 0% to 100%. E.g. 0.1 will be displayed as 10%. In your case you can divide the |
The problem I'm having isn't with the normal bar plot but with the stacked bar plot. Your explanation of the percent function makes sense, and the base functions might be the same between both plots -- I haven't looked into it -- but with or without the percent, I'm getting an extra couple orders of magnitude: Code (same as above, just removing the axis tick format):
with Covered_percent data formatted as such: 6.91 I do not have the same issue with a standard bar plot:
Thanks for the help! |
Ah I see, thank you! So in my mind I was imaging a stacked bar plot with each categorical value having a max numerical value based on the largest sample value (e.g 32% in this case for chr1), rather than summing the values from each sample, then extending past each other as if they were stacked in order behind each other on the z-axis. |
You could use this if the order of the largest sample is consistent across #ID:
If the order changes I'd try something like:
|
Gotcha that makes sense -- thanks for the help! Sorry for the confusion on my end. |
Is this a BUG REPORT or FEATURE REQUEST?:
type: bug
Environment:
What happened:
I'm getting an extra two orders of magnitude (or more if I set a floating point on the tick value) for values with floating points in stacked bar charts.
What you expected to happen:
When setting the y axis tick values to '0%", I should get percentage values ranging from 0-100%.
How to reproduce it (as minimally and precisely as possible):
Plot all chromosome data using stacked bar plot
RdGy = chartify.color_palettes['RdGy']
shifted_RdGy = RdGy.shift_palette('black', percent=20)
shifted_RdGy.show()
(chartify.Chart(blank_labels=True,
x_axis_type='categorical')
.style.set_color_palette('diverging', palette=shifted_RdGy)
.plot.bar_stacked(
data_frame=results,
categorical_columns='#ID',
categorical_order_by='labels',
categorical_order_ascending=True,
numeric_column='Covered_percent',
stack_column='sample',
normalize=False)
.set_legend_location('outside_right', orientation='vertical')
.axes.set_yaxis_tick_format('0.0%')
.axes.set_xaxis_tick_orientation('vertical')
.show('png'))
Anything else we need to know?:
Included the df and ipynb if you want to replicate.
Allen_concatData.txt
pileup.zip
The text was updated successfully, but these errors were encountered: