Create a stacked bar chart from data frame - dataframe

got this data frame which i want to make into a stacked bar chart with the columns on the x axis
enter image description here
tried using barplot but just recive error 'height' must be a vector or a matrix
tried using ggplot(dataframe) and just returns grey rectangle

Related

How can I plot something above a negative stacked bar chart using Matplotlib Python?

wish you a good day ! I must plot something like that using matplotlib : enter image description here
The standard ax.bar() function does not easily plot stacked bar charts with negative values, that's why I used dataframe.plot(stacked = True) to plot this bar. The problem is that I need to plot a line plot above this bar chart. This line should use the second vertical axis, so I need to get the current matplotlib axis object used by my dataframe.plot(stacked = True) function, I need to twinx() it and then plot the line on the twined axis.
However these 3 things do not work :
enter image description here
which gives :
enter image description here
enter image description here
which gives :
enter image description here
and
enter image description here
which gives :
enter image description here
I dont know what is going wrong, I know the problem stems from the dataframe.plot(stacked = True) function which is the only one that stacks easily bar charts with negative values.

Duplicates not visible on bar graph

I have created a bar graph using a dataframe. The x-axis has duplicate values but it is not showing. I have provided the code, dataframe and bar graph below
car_sales.plot(x="Make", y="Odometer (KM)", kind="bar");
Bar graph
Dataframe

Matplotlib stacked bar chart not showing all bars

I will make a stacked bar chart in matplotlib. Somehow it doesnt include all the bar chart that i gave him (there should be like 50 bar charts stacked on each other)
The code:
N=45 #numbers of columns
max_el=50
ind=np.arrange(N)
for bar in range(0,max_el):
y=[dic[value][bar] for value in dic]
plt.bar(ind,y,)
plt.show()
note: I used the similar code and same data and made a stacked bar chart with plotly (which worked)
With plotly
With matplotlib
Some of the values of variables are zeros or 0.1. Could that be the problem ?
As described in the comments, you need to add a bottoms array that keeps track of how much each should be moved up from the 0 line. Otherwise, they all start plotting a 0 and overplot one another, with the tallest one sticking up to its values and each one hiding those that were plotted before.

MP line chart - Unable to plot area on line chart with XY Axis limits

Any one help me to achieve the following chart
Click here to view full image

matplotlib: plot or scatter without line through marker

is there a simple way to have scatter() plots (or just plots) with data points shown by some marker and connected by lines, but, when markerfacecolor='none' (or facecolor=none) have the line not shown within the area of the marker.
E.g.:
xx = arange(0.0,10.0,0.5)
yy = sin(xx)
plt.plot(xx,yy,'k-',marker='o',markerfacecolor='none')
results in the following figure.
But I would like the lines connecting data points to start not from the center of each marker but from its borders.