Questions tagged [plotnine]

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.

179 questions
0
votes
2 answers

How to add legend in plotnine for multiple curves when "tidy data" is not the issue

Several people have asked how to add a legend in ggplot2 or plotnine for multiple curves when the curves differ by the selection of rows to be plotted. The typical answer is to reformat the data as tidy data. Some examples are here, here, and…
hsafer
  • 57
  • 1
  • 9
0
votes
1 answer

Plotting Dataframes with plotnine

I currently have a table as seen below, however I am trying to plot a min and max interval with plotnine, for which I am trying to plot in a more sorted order as it is a mess. Currently I am sorting by the "true"column of my data but this does not…
0
votes
2 answers

Plot Min and Max Intervals with Plotnine?

Currently I am able to plot a min and max interval with matplotlib, however I wish to do the same with the plotnine library, would this be possible? I am trying but am not successfull Matplotlib code plot_range =…
0
votes
1 answer

Plotnine print one line for each entry in DataFrame

I have the following DataSet given: intervall_start intervall_ende variable value time 0 2019-08-01 05:00:00 2019-08-01 05:15:00 Door_1 30.0 5.00 1 2019-08-01 05:15:00 2019-08-01 05:30:00 Door_1 55.0 …
Jan
  • 1,180
  • 3
  • 23
  • 60
0
votes
1 answer

Python-ggplot: Adding moving average to plot

p = ggplot(cases, aes(x="Specimen date", y="Daily lab-confirmed cases", group = 1)) + geom_point() + geom_line() + labs(title = "Daily COVID-19 Cases") p.save(filename = date_today, height=5, width=15, units = 'in', dpi=1000) This is my current…
0
votes
1 answer

PlotnineAnimation with changing scales throws error: 'The fill scale of plot for frame 1 has different limits from those of the first frame.'

I am trying to use the gganimate (R) equivalent, plotnine (python). I run into problems when one of the plots introduces a new aesthetic scale category, causing the console to throw the error: The fill scale of plot for frame 1 has different limits…
MorrisseyJ
  • 1,191
  • 12
  • 19
0
votes
2 answers

What is the proper way plot multiple lambda function in plotnine so legend appears?

This looks like it's fairly close to the answer I'm looking for but it's not quite there. Perhaps I'm not following the "tidy data" principles and will need to make a dataframe evaluated at many points to plot these functions but I'm hesitant to…
financial_physician
  • 1,672
  • 1
  • 14
  • 34
0
votes
4 answers

plotnine doesn't add legend

I'm using plotnine to plot two graphs in the same plot. one graph uses the 'b' values from the dataframe you'll see below, and another one uses the values from 'c'. All I need is to show a simple legend legend where I see 'c' and 'b' with their…
drdisrespect
  • 55
  • 1
  • 11
0
votes
1 answer

How to plot a boxplot of single column using plotnine in python without any grouping?

This is mt cars data-set. I want to plot the box-plot of mpg column, we also have to specify x aesthetic if we are not it is showing error ( ggplot(cars,aes(y='mpg',x=))+geom_boxplot() )
0
votes
2 answers

Is position_dodge2() working for python with plotnine?

I'm using ggplot in python with plotnine, I have this piece of code: my_plot_availability = (ggplot(df) + aes(x='time_elapsed',y='mean',fill='policy') + geom_bar(position=position_dodge(),stat = "identity", color = "black",size =…
BlueMountain
  • 197
  • 2
  • 17
0
votes
0 answers

Plotting with plotnine opens many windows

I am using plotnine to plot graphics. plotnine uses Qt. When I plot the first graphic, e.g. with import pandas as pd measurements = pd.DataFrame({'time': [0,1], 'value': [2,3]}) import plotnine as p p.ggplot(p.aes('time', 'value'), measurements) +…
Make42
  • 12,236
  • 24
  • 79
  • 155
0
votes
1 answer

Color ggplot2 values by a sorted unique column values in Python

I came across this package plotnine which can give the same results as R's ggplot2 in Python. It's pretty useful but I have a problem coloring "label_1" and "label_2" values by their unique "ID"s. The colors should be distinguishable. It could be…
Mine
  • 831
  • 1
  • 8
  • 27
0
votes
1 answer

plotnine geom_boxplot ignores required aesthetic and requires unnecessary aesthetic

I have data that looks like: Scenario ymin lower middle upper ymax One 16362.586379 20911.338893 27121.693254 35219.449009 46406.087619 Two 19779.003240 25390.096116 33108.174561 43545.202225 …
GoneAsync
  • 349
  • 5
  • 18
0
votes
0 answers

Getting No module named 'plotnine' error despite downloading plotnine package

I downloaded plotnine using pip, and though the installation seemed successful, I still get a No module named 'plotnine' error while running my pythons script. I have tried uninstalling SciPy, then reinstalling plotnine My import statement looks…
0
votes
1 answer

How to map continuous variable to color in plotnine?

I'm trying to map a continuous variable to color in plotnine. In R, I can do this by setting color param to log(pop). In plotnine, I tried this alternative, and it generates this error: ValueError: Image size of 300573x430 pixels is too large. It…
Fred R.
  • 557
  • 3
  • 7
  • 16
1 2 3
11
12