Closed ev-anderson closed 7 months ago
👋 Thanks for opening your first issue here! Please make sure you filled out the template with as much detail as possible. You might also want to take a look at our contributing guidelines and code of conduct.
Thanks @ev-anderson for writing up this detailed report!
Looking at your code, I see you are not specifying the region
parameter, when plotting the first histogram. As I do not have your input data, I wrote an example with random numbers. Btw we have just released PyGMT v0.11.0 🙂.
import numpy as np
import pygmt
# Sample data
rng = np.random.default_rng(seed=100)
mean = 100
stddev = 20
data01 = rng.normal(loc=mean, scale=stddev, size=42)
data02 = rng.normal(loc=mean, scale=stddev * 2, size=42)
# Create new figure instance
fig = pygmt.Figure()
# Create histogram for data01
fig.histogram(
region=[0, 200, 0, 12],
# Automatic range determination does not work for overlaid horizontal histograms
# region=[0, 200, 0, 0],
projection="X10c",
frame=["WSne", "xaf10", "ya1f1+lCounts"],
data=data01,
series=10,
fill="black",
histtype=0,
label="data01",
horizontal=True,
)
# Plot histogram for data02 on top of the histogram for data01
fig.histogram(
data=data02,
series=5,
fill="white",
pen="1p,darkgray,solid",
histtype=0,
label="data02",
horizontal=True,
)
fig.legend()
fig.show()
# fig.savefig(fname="histogram_overlaid_horizontal.png")
vertical | horizontal |
---|---|
I'm closing the issue since @yvonnefroehlich can't reproduce it. Please reopen it if you can provide a minimal example with datasets.
Description of the problem
Hello,
I am trying to plot 2 datasets on a histogram horizontally, however the second dataset seems to keep getting covered by the first despite the histogram call for the first dataset occurring before. The first dataset is larger and should be plotted first so as not to cover the second dataset. I've been able to see both datasets plot in the following conditions:
dataset1 horizontal = False, dataset2 horizontal = False
dataset1 horizontal = False, dataset2 horizontal = True
I have not been able to see the second dataset plot for the following:
dataset1 horizontal = True, dataset2 horizontal = True
dataset1 horizontal = True, dataset2 horizontal = False
I've tried looking for the man pages to see if perhaps I am missing some flag, but could not find anything. Any ideas what the issue might be?
Below are the output plots from the respective conditions I stated above.
Minimal Complete Verifiable Example
Full error message
No response
System information