I'm struggling with a basic qs.
My dataframe looks like this:
q = pd.DataFrame(data=[[28,50,30],[29,40,40],[30,30,30]],columns=['sprint','created','resolved'])
I want to plot a barplot with sprint & for each sprint I want to plot created & resolved.
Can someone help out how this can be done?
Pandas can use matplotlib in order to display information of pandas objects. In your case it seems for me the easiest way to go with pandas plots.
The following gives you a plot with only the information about the sprints as a bar plot
df.sprint.plot(kind='bar')
This gives you a plot for each sprint showing the created and resolved tasks
df.groupby('sprint').plot(y=['created','resolved'], kind='bar')
Related
I have a simple dataframe and I'm running this simple code.
from plotly import graph_objects as go
fig = px.funnel(df, x='MeanDispatchedTime', y='Station_Name', color='MED_Type')
fig.show()
Is there some way to get the colors separate and distinct, so the red doesn't bleed into the lower levels? I'm looking at the documentation here.
https://plotly.com/python/funnel-charts/
Or, perhaps, this is completely the wrong chart to be using to tell the story...
Here is an example of MACD plot using python.
https://code.luasoftware.com/tutorials/algo-trading/python-mplfinance-plot-yfinance-candle-chart-moving-average-macd-and-volume/
I'd like the result (including colors and crossover points, etc.) to be the same as that of tradingview.com
https://www.tradingview.com/script/NDH8bJow-MACD-Colors-Signals/
Could anybody show the python so that it is the same as that of tradingview.com?
Could anybody show the python so that it is the same as that of tradingview.com?
I don't think anyone is going to want to write your code for you.
However what I would recommend is that you work through the mplfinance tutorials on Customizing the Appearance of Your Plots and especially teach yourself about mplfinance styles which shows how to modify the overall color scheme of your plot. See also mplfinance style sheets reference.
For example, to achieve a color scheme similar to trading view you could use the "market colors" from style 'yahoo' and the combine that with mplfinance style 'nightclouds'. Something like this:
mc = mpf.make_marketcolors(base_mpf_style='yahoo')
s = mpf.make_mpf_style(base_mpf_style='nightclouds',marketcolors=mc)
Then when you call mpf.plot() specify kwarg style=s
hth
So I have a dataframe that consists of several variables, such as the amount of comments from an instagram page and the upload date of each post. For this, I used the package Instascrape
Now I want to make a scatter plot from these two variables, with the date on the x-axis and amount of comments on the y-axis using the following command:
plt.scatter(posts_df["upload_date"], posts_df["likes"])
plt.show()
Now I face the following problem, I get the scatter plot but the dates are overlapping. I believe that this is due to the fact that it shows every date on the x-axis, if they are close to each other the dates are overlapping.
I tried to convert it using:
plt.scatter(posts_df["upload_date"], posts_df["comments"])
plt.show()
But that did not change anything. The dates look like this: upload_date
0 2020-12-26 01:23:57
how can I solve this?
I solved it by using simply the command:
plt.gcf().autofmt_xdate()
This is extremely trivial, so I apologize!
I'm just getting into matplotlib and pandas and I think I'm over complicating it...
I'm trying to create a clustered bar chart (like the one below).
The dataframe I a working with is structured like this:
I want to create a clustered bar chart where the x-axis is days of the week (df['Days of Week']), the y axis is count, and the categories of what is being counted are Type A and Type B (determined by df['Type']).
From the googling I am doing, my code is long and complicated... but I feel like this is easier than I'm making it...
Any help appreciated!
Try this:
new_df = (df.groupby('Days of Week')['Type']
.value_counts()
.unstack()
)
new_df.plot.bar()
i am trying to make a bar chart using pandas and matplotlib. The data is depicted in the dataframe (champs_by_number_of_matches) bellow and it is Greek.
by typing: champs_by_number_of_matches.plot(kind = 'bar')
i get the graph bellow. How can i get the x-axis labels to show Greek?
This is a frequent problem i have encountered and i dont want to convert the labels to "Greeklish".
Thank you.