204 questions
1
vote
1
answer
82
views
Plotnine printing point geometry legend as polygon
In my map I have multiple layers. One being points and others being polygons. I want show proper legend (points to show points, polygons to show polygons), whatever way I try I cannot get it to wok.
...
1
vote
1
answer
34
views
Data is missing after order by a column
I have to generate a graphic of median_rate by year of measles contamination. I noticed the data goes missing after this line:
filtered_data['state'] = pd.Categorical(filtered_data['state'], ...
1
vote
0
answers
57
views
When using ggplot in pyycharm, why am i getting the following error message (see below)?
I am trying to create visuals on Pycharm using ggplot but I receiving the above error message. I used to have no issues running the code and obtaining the visuals in the past. This is the code that I ...
0
votes
1
answer
500
views
Plotnine: How to use geom_col and geom_text to display mean by group
I have a dataset that I am using geom_col to visualize using stat='summary'. I can't quite figure out how to use geom_text() to display the mean values. Here is the code and plot I am able to produce:
...
0
votes
1
answer
82
views
How to create bar chart with geomean, mean, max and min from data using Plotnine
How to create bar chart with gmean, mean, max and min stats for each category.
For the data below,
X
B
Y
A1
b1
4
A1
b2
2
A1
b3
3
A1
b4
8
A2
b1
7
A2
c1
10
A2
c2
8
A2
b3
7
A3
b4
10
A3
b5
9
A3
b1
4
A3
b3
...
-1
votes
2
answers
137
views
Signal Plotting with Jupyter Notebook
I have been trying to plot a certain signal on python but it keeps giving me an error message I don't know how to solve it
from matplotlib import pyplot as plt
from matplotlib import style
import ...
0
votes
2
answers
486
views
Plot multiple dataframe in a plot with facet_wrap
I have a dataset df that looks like this:
ID Week VarA VarB VarC VarD
s001 w1 2 5 4 7
s001 w2 4 5 2 3
s001 w3 7 2 ...
0
votes
0
answers
432
views
Using ggplot abline to plot multiple coefficients from the model
It's been impossible finding an answer to this question. If you have a simple linear graph, you have one slope and one intercept abline(intercept = 1, slope = .5; if you plot a regression, you can ...
0
votes
1
answer
557
views
module 'plotnine' has no attribute 'ggplot_build'
p3 = (p9.ggplot(data = df, mapping = p9.aes(x = 'gross_power',
y = 'temp_drop_a',
show_legend=False, alpha = 0....
0
votes
1
answer
72
views
Overlaying G-plots
I have to overlay two plots but am having troubling with naming them and going about plotting them. I've tried doing the code below for the two plots I want to compare.
geom_plot1=ggplot(data=...
0
votes
0
answers
484
views
Plot live streaming data (two y-axix values sharing same x-axix) in python
I want to achieve the following:
Here, the blue line must be the live streaming data obtained from a sensor (the above plot is of the stored dataset, not the live streaming). I'm trying to find the ...
0
votes
0
answers
45
views
How to add legend in ggplot in R? [duplicate]
I'm making a plot with 2 y-axis and it's all alright except that I can't have my legend in my plot,
I tried commands :
scale_color_hue
scale_color_manuel
And still nothing,
Here is my code :
ggplot()...
0
votes
0
answers
686
views
UnboundLocalError: local variable referenced before assignment -- add as global variable?
I am running Python v3.8.6. When I run the following code, it works.
def plot_timeseries(vars_to_plot, plt_config, plt_type=None):
if plt_config['ggplot']:
# Use ggplot style (grey ...
2
votes
1
answer
1k
views
reverse order of discrete x axis in plotnine
In python, I am trying to reverse the order of my x-axis so that 2015 is on the far left and 2019 is on the right. The goal is to then have 2019 on the bottom after I coord_flip() the plot. See here.
...
0
votes
1
answer
3k
views
How do I plot a beautiful scatter plot with linear regression?
I want to make a beautiful scatter plot with linear regression line using the data given below. I was able to create a scatter plot but am not satisfied with how it looks. Additionally, I want to plot ...
1
vote
0
answers
295
views
Power BI with ggplot in python
I have created below code in python for Power BI. This is not showing anything.
# The following code to create a dataframe and remove duplicated rows is always executed and acts as a preamble for ...
0
votes
1
answer
931
views
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 ...
2
votes
1
answer
1k
views
Fit non-linear curve using Plotnine
Here's a working sample for producing linear curves for some user-defined metrics..
How can I have it fitted to a non-linear curve?
def plot(version, str_metric):
metric1 = [0.459, 0.5844, 0.6246, 0....
0
votes
1
answer
334
views
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:...
1
vote
1
answer
921
views
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 = ...
3
votes
1
answer
2k
views
Plotting data from different datasets using plotnine and pandas
First off, I think it would be helpful to offer some background about what I want to do. I have a time-series dataset that describes air quality in a region, with hour resolution. Each row is an ...
1
vote
1
answer
1k
views
How to add legend in ggplot/plotnine for multiple curves
Here is a sample code which I am using to plot two curves. How can I add the legends to the plot? I saw some post where it was suggested to add color within aes but that throws the exception
plotnine....
0
votes
4
answers
5k
views
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 ...
1
vote
1
answer
3k
views
Circular barplot in python with percentage labels
I am a newbie to python and have little experience in R.
I have a data frame with gut_list and percentage. I want to create a circular barplot/race track plot with labels. I saw a post in R ggplot to ...
0
votes
2
answers
723
views
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(...
1
vote
1
answer
273
views
How to add space between 2 bar plot python
I tried to add space between 2 bars
plot.bar([value for value in range(len(y))+0.25], z, width=0.4)
but it was showing error "cant convert list to float"
x = x[xleftpos:xrightpos]
y = y[xleftpos:...
0
votes
1
answer
652
views
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 ...
0
votes
2
answers
445
views
Error using categorical column in geom_density
When converting a column to a type categorical, and setting the some aesthetics property (aes()) to use it, I'm getting the following error:
NotImplementedError: isna is not defined for MultiIndex
...
0
votes
2
answers
943
views
How to plot the distribution of each in feature in cancer dataset
I want to get the distribution of each features in cancer dataset using ggplot but its giving me error.
#pip install plotnine
from plotnine import ggplot
from plotnine import *
from sklearn.datasets ...
0
votes
1
answer
449
views
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: ...
1
vote
1
answer
3k
views
"Could not evaluate the 'color' mapping" error in Plotnine
I'm having an issue with Plotnine on python everything is working fine except when I attempt to specify a color in aes I get an error saying:
PlotnineError: "Could not evaluate the 'color' mapping: '...
2
votes
1
answer
206
views
How to avoid stacking names in the barplot?
I am making a barplot in ggplot2 where the "country" is compared to "suicides per 100,000 people". My problem is that country names are stacked on top of each other in the graph.
In the past, I tried ...
0
votes
0
answers
175
views
How can I plot the graph to display the moving averages on the stock prices
I am trying to plot a matplotlib graph to plot moving averages on the stock
prices, but it's not working.
I have written the code but I kept getting error messages.
%matplotlib inline
import ...
0
votes
1
answer
31
views
How to properly build a dataframe in ggplot to plot different charts
I'm running a lot of simulations in the field of electrical systems using PSS/E. Currently, I'm on the phase of treating the captured data to visualize it.
I have already investigated over the ...
2
votes
0
answers
30
views
Can't facet on variable with more than 9 levels in python ggplot
This code works:
import pandas as pd
from ggplot import *
df = pd.DataFrame(data = {'facet_var': [1,2,3,4,5,6,7,8,9,1], 'hist_var': [1,2,3,4,5,6,7,8,9,0]})
ggplot(aes(x='hist_var'), data = df) + ...
0
votes
0
answers
63
views
How to plot activities by hour based on dataset in ggplot?
I'm trying to create code that will plot the number of entries into the MTA by hour. I have a csv dataset of entries and the hours they occur. I've reduced the dataset to a Pandas dataframe with just ...
0
votes
1
answer
59
views
An integer list on python can be used to produce an histogram or a boxplot with ggplot?
I want to know what kind of data i can used to make histograms on python with ggplot
I have this list :
dataUsersNumber=[52854, 149829, 294425, 492003, 10890, 0, 437683, 759]
And this is the code ...
1
vote
0
answers
435
views
can not use ggplot in pycharm but spyder can
from ggplot import *
import pandas as pd
y_name = 'y'
df = pd.DataFrame({"x":[1,2,3,4],y_name:[4,5,6,7]})
p =ggplot(df, aes(x='x', y='y'))+geom_point()
Then my PyCharm collapse, no photo and I have to ...
0
votes
0
answers
43
views
How to plot time-series with value of index number on the peak? [duplicate]
I want to assign index number for peak both blue and green and want output like following picture. Index number of blue color is array(maxtab)[:,0] and green color is array(mintab)[:,0] that I ...
1
vote
1
answer
560
views
Simple Method to Plot Columns in Pandas Dataframe on Different rows of plot?
Is there a simple method to plot all columns on different rows/ tiles, with a shared X-axis? Ido not want to go deep into matplotlib subplots for each new figure; I'm looking for something simple that ...
0
votes
2
answers
220
views
Trouble with matplotlib after installing ggplot
Yesterday, I installed the ggplot to my anaconda environment.
When I tried to use the matplotlib plot that worked before I installed ggplot I am getting the below error. I am also getting errors from ...
1
vote
1
answer
1k
views
ggplot Python : Error : TypeError: 'module' object is not callable
Hi I am trying to use ggplot library in Python. So I pip install gglot in my Anaconda command prompt. I tried basic plotting (Example from http://ggplot.yhathq.com/docs/geom_density.html) in jupyter ...
1
vote
1
answer
486
views
Remove legend in ggplot in Python
The title says it all: Is there any way to remove the legend in ggplot in Python? I tried to google but could only find the solution for R
0
votes
1
answer
2k
views
FutureWarning: pandas.tslib is deprecated and will be removed in a future version
Im trying to import MTcars dataset but im getting this error
enter image description here
2
votes
1
answer
658
views
Is ggplot2 for python via plotnine not supported anymore?
Eventhough I get a proper diagram (yeay!), I also get this warning each time I run ggplot:
FutureWarning: Attribute 'is_copy' is deprecated and will be removed in a future version.return object....
21
votes
5
answers
31k
views
ImportError: cannot import name 'Timestamp'
I have ggplot successfully installed in my python 3.6.3 using the code below:
conda install -c conda-forge ggplot
But when I import it in my notebook using the code below, I get an error:
from ...
0
votes
1
answer
156
views
Matplot lib add session( duration ) indicator and represent y-axis as stars
I have simple series of user-events, where the is a login and logout, and in-between few activities are performed. I tried various types of graphs and kinds but no luck.
I want to represent time ...
4
votes
1
answer
10k
views
How to add a DynamoDB global secondary Index via Python/Boto3
Is it possible to add a Global Secondary Index to and existing DynamoDB table AFTER it has been created? I am using Python 3.x with Boto3 and have not been able to find any examples of them being ...
1
vote
0
answers
219
views
Rotate labels in python ggplot facet_grid()
Is it possible to rotate the labels resulting from faceting in Python's implementation of ggplot? Here is an example of what I have in mind:
import pandas as pd
from ggplot import *
df = pd....
1
vote
0
answers
322
views
matplotlib redraw removes background
I'm trying to use matplotlib in a Qt5 app, to do some live plots. Focusing on speeding up the drawing of the graph, based on what Basti wrote on his blog (http://bastibe.de/2013-05-30-speeding-up-...