plotnine is a python plotting package that implements a "Grammar of Graphics" . It is based on the R package ggplot2 and has an API that is similar.
Questions tagged [plotnine]
179 questions
0
votes
0 answers
Adding curly braces to python's plotnine graph
I would like to add curly braces to a plotnine plot to highlight a feature.
At the moment I an annotating a '}' onto the plot, but in order to get it the right width, the brace is far too fat. This is also not scalable should I want it to expand to…

brb
- 1,123
- 17
- 40
0
votes
1 answer
Axis scaling with plotnine
Until now I've spend several hours to get axis scaling in plotnine done.
Everything I've found until now does not work.
Is it the data, is it the code defining the graph, hope any of you would be able to see what is wrong.
The data looks like:
Data…

Stefan
- 113
- 7
0
votes
2 answers
Hide certain categorical element from legend in Plotnine
In Plotnine, is it possible to hide certain legend elements?
mpg_select = mpg[mpg["manufacturer"].isin(pd.Series(["audi", "ford", "honda", "hyundai"]))]
I have selected only 4 manufacturers. But when I plot the data, I still see the manufacturers…

jxu
- 50
- 4
0
votes
1 answer
"Could not evaluate the 'x' mapping: 'Cluster' error in plotnine
I'm running this code to identify the number of clusters I need with a K prototype clustering and I'm getting this error
PlotnineError: "Could not evaluate the 'x' mapping: 'Cluster' (original error: name 'Cluster' is not defined)"
# Choose…

Ahmed JAÏEM
- 11
- 3
0
votes
1 answer
Plotnine/ggplot multiple dimension boxplots or jitterplot
I'm trying to make a specific plot using ggplot/plotnine. I'd like to keep it plotnine if possible so everything I've done can stay in the same notebook.
Essentially I want to create a box/jitter plot that allows for separation by category or…

mk2080
- 872
- 1
- 8
- 21
0
votes
2 answers
How to plot a graph from 2 columns in a dataframe using plotnine?
I am trying to understand how this works
Dataframe is "result"
Column in "result" is Time, Column1, Column2
I am able to plot only a single line from the Column1 from the code below:
(p9.ggplot(data=result,
mapping=p9.aes(x='Time',…

sam
- 115
- 2
- 10
0
votes
1 answer
Change line type manually for trend line using plotnine geom_smooth in Python
I am plotting a line graph for two groups in Python and I would like to add two trend lines as well. The data is in the data frame, df.
data = [[1, 4.5,'group1'], [2, 4.25,'group1'], [3, 3.75,'group1'],[4, 3.5,'group1'],[1, 4.0,'group2'],[2,…

Rnovice
- 333
- 1
- 5
- 18
0
votes
0 answers
Install Plotnine failed in Jupyter Notebook : ERROR: Could not install packages due to an EnvironmentError: [WinError 5] Access is denied
Dear All beloved members,
I am synat and very new to python. Mostly I used python for data sciences and recently installed plotnine module in Jupyter Notebook, but did not work.
I used the following code
!pip install plotnine
and the output I got…

synat
- 27
- 6
0
votes
1 answer
PlotnineError: 'Aesthetics must either be length one, or the same length as the data'
I am trying to build a waterfall chart using plotnine. Have 9 groupings (percentiles), so I would like a 3x3 facet_wrap plot.
Below is some sample data and what I want the plot to look like based on 1 of the 9 groupings. I get errors when trying to…

brb
- 1,123
- 17
- 40
0
votes
1 answer
Colour bars based on values in pandas dataframe when using plotnine
I am trying to build a waterfall chart using plotnine. I would like to colour the starting and ending bars as grey (ideally I want to specify hexadecimal colours), increases as green and decreases as red.
Below is some sample data and my current…

brb
- 1,123
- 17
- 40
0
votes
1 answer
plotnine issu using stat_smooth and geom_path
Stackoverflow community,
I currently have a problem using plotnine in python.
My code is the following:
from plotnine import *
from plotnine.data import mpg
%matplotlib inline
plot = (ggplot(result) +
aes(x = 'age', y = 'fa index', color='ID') +…

Clément
- 1
- 1
0
votes
1 answer
Creating plot using plotnine of python from R through reticulate
Being a R user, I am learning to incorporate python command in R through reticulate, I tried plotting graph using the plotnine package in R but it returned the following error, can anyone help?
library(reticulate)
library(ggplot2)
pd <-…

lokheart
- 23,743
- 39
- 98
- 169
0
votes
1 answer
How to create a Cumulative Revenue Graph?
I am trying to display the cumulative average revenue for each year my customers did a transaction, based on the Year the customers were onboarded (first transaction).
I think I need to use groupby but I figure out the best way to achieve the…

Killi Mandjaro
- 145
- 2
- 15
0
votes
1 answer
Do not sort variable in lineplot
I'm trying to make a plot of mean slope x elevation for a given area, but I'm a bit lost with the sorting of data in plotnine. The dataframe has 3 cols: Elevation (already ordered from low to high), Slope (unordered, must remain as is), DEM (used…

Carlos Grohmann
- 27
- 3
0
votes
1 answer
How to add a geom_point layer based on a condition in python
I am using python package plotnine based in R's ggplot and I am trying to create a plot where I want a line to be plotted, and then, I want to add a geom_point layer that plots only some points if a given criteria is verified.
So I have a dataframe…

Álvaro Méndez Civieta
- 725
- 3
- 12
- 33