I tried to plot multiple tasks in horizontal bars with Python.
I have timestamps on the x axis and tasks on the y axis. These tasks appear multiple times a day so I need to display many of them in one row. All together like a giant diagram with multiple tasks and gaps
Any idea how to plot this? It's enough to send me the name of the diagram. I searched but found nothing what I need. I need something similar like the attached picture
Related
I am doing a study in school about the effect of noise in a person's environment and his/her activity.
I have two dataframes with data I would like to compare. The data was recorded at the same time, but the time intervals between measurements are different. This makes it hard for me to overlay a plot and look at possible correlations.
The data frames look like this:
Volume level:
steps:
When I try to put these two dataframes in one plot with a sync timeline, the steps graph looks way smaller than the volume level graph. I have tried to plot the two graphs in multiple ways, but I keep ending up with something like this:
How about this.
This code uses multi y axis so it will help you with your problem that the graph size doesn't fit.
ax = steps_Niels_1st["steps"].plot()
ax1 = ax.twinx()
ax = volume_data_Niels_1st['size'].plot(ax=ax1)
plt.show()
So looking around i've seen a few posts about combining graphs online,but none seem to apply to the graphs im using. while i'm happy to use matplotlib I can't seem to get my code to work in that while it does work in panda.
df = pd.read_excel (r'FILE-Location', index_col='PT: TD: BP')
df.iloc[1:2].T.plot()
df.iloc[2:3].T.plot()
These are the two seperate plots I wish to plot onto the same graph. I know it's a weird request and I could very easily combine them by making it [1:3] however I wish to keep them seperate as I plan to have them as options on tkinter, in which you can check a box of which lines you would like displayed, in order to do this I have to keep them seperate.
Thanks for any help solving this.
Edit: thanks for linking a similiar post, I tested the methods given there and they all seemed to simply plot into four seperate graphs within the same figure, while im looking for all four overlayed onto the same graph.
I've been dealing with this issue for sometime now. I have a typical time series over some measure. My code and logic is pretty complex to display it here, I'll try to summarize it instead.
My chart by default is organized in DAYS, but if I zoom in, using relayoutdata, I re-organize my dataframe by HOURS, zooming further, by Minutes, and the smallest gradation is by Seconds:
The problem appears when I try to zoom on time areas that don't have any data to display, or have a single record. If I have at least two points on a chart, everything works as expected:
but if I nudge the zoom by tiny bit so to exclude one of the two remaining columns, the whole visualization rescales to this following chart.
This is the problem
This is the desired output:
On zoom, I re-filter my pd.DataFrame, and as with the last example, my df only has one record. So, the Plotly is driven by that one data point, and what I would like instead is to display the data and force it to use:
{'xaxis.range0': '2021-10-08 12:17:44', 'xaxis.range1': '2021-10-17 00:20:39'}
My thought process was to keep track of how many data points I have in the dataframe, and if the count is below a certain threshold, to artificially fill df with 0s. But I believe this is patchy solution, and maybe there's a more elegant way to keep the timeline consistent.
Any help will be greatly appreciated.
I'm using Bokeh's hbar_stack() method in order to make a stacked horizontal bar chart.
In Matthew Rocklin's post here, the very first chart plots how long tasks take on different worker cores. It plots "read-block" and "pandas_read_text."
I was wondering how you could get multiple bars of a phase (ex. "read-block") onto the same y-axis when using hbar_stack(). Any general advice behind how this chart is created would also be helpful.
I'm experimenting with Bokeh server. I have a document with three figures and I'm trying to update two of them depending on the selection I perform on the third. The number of lines to plot in the two figures changes every time.
If I could use multi_line, this would be trivial: I would change the xs and ys in the data_source of the multi_line.
Alas, I need to use multiple scatter plots because multi_line does not support hover and I need it.
So, what I would like to accomplish is to clear the two plots every time I select something in the third, and display the scatter plots corresponding to the new selection.
There are a few possible workarounds, of course (appending scatter points to have a single GlyphRenderer with all scatter plots together, for example, but this would mean using very clunky ways to send the right hover message...). But if it was possible to just clear and update single figures, everything would be cleaner. I couldn't find anything in the docs, however.
I have read the thread you created on the mailing list and this other thread where Bryan says:
Technically, glyph renderers are stored in the .renderers property of
Plots, but I would not recommend rooting around there by hand.
Specifically the "Continuous Updating" notebook I linked earlier has
an example of updating both the data and appearance of an existing
glyph using python and push_notebook. There is not any easy way to remove glyphs at the moment,
other options would be:
recreate a new plot
set the glyph to be invisble
update the glyphs data
So it seems they are the only solutions at the moment