A python plotting library emulating R's ggplot2. https://github.com/yhat/ggplot/
0
votes
1answer
17 views
Plotting over groups of values in Python
I have a dataframe that looks like this.
country age new_user
298408 UK 32 1
193010 US 37 0
164494 UK 17 0
28149 US 34 ...
0
votes
0answers
27 views
Use same colors as ggplot with matplotlib
I am making some plots with two different libraries: ggplot and matplotlib. With the first one I make a density plot for a certain number of datasets, with the second one I make the respective ...
3
votes
1answer
81 views
ggplot multiple plots in one object
I've created a script to create multiple plots in one object. The results I am looking for are two plots one over the other such that each plot has different y axis scale but x axis is fixed - dates. ...
2
votes
1answer
29 views
In ggplot for Python, using discrete X scale with geom_point()?
The following example returns an error. It appears that using a discrete (not continuous) scale for the x-axis in ggplot in Python is not supported?
import pandas as pd
import ggplot
df = pd....
0
votes
0answers
12 views
How to plot multiple y variables using ggplot (Python)
I have the following data in a Pandas data frame:
Company Date Revenue Profit
ABC 08/21/16 00:00:00 500 300
ABC 08/22/16 00:00:00 600 200
...
0
votes
0answers
28 views
How to plot multiple y variables from the same data frame using ggplot (Python) without using melt [duplicate]
I have the following data in a Pandas data frame:
Company Date Revenue Profit
ABC 08/21/16 00:00:00 500 300
ABC 08/22/16 00:00:00 600 200
...
1
vote
2answers
46 views
Python: Plot a bar graph for a pandas data frame with x axis using a given column
I want to plot a bar chart for the following pandas data frame on Jupyter Notebook.
| Month | number
-------------------------
0 | Apr | 6.5
1 | May | 7.3
2 | Jun | 3.9
...
0
votes
0answers
16 views
ggplot formats dates unintelligibly when using facet_grid
In searching StackOverflow, I see that there have been issues with x-axis formatting when using facet_grid. For example, there is this:
https://github.com/yhat/ggplot/issues/295
My code is as ...
0
votes
0answers
23 views
Python ggplot: theme overwrites scale_x_date
I am trying to build a simple plot with Python ggplot.The data for this example is here.
Here is some setup code:
import pandas
import ggplot
df_cat_turn = pandas.read_csv("02 - Data\F&...
2
votes
2answers
45 views
Python, Roc curves and ggplot?
I followed a tutorial for displaying the roc curves and the corresponding auc; I never used the ggplot library, thus I cannot understand where is my error. Here the code below:
from sklearn ...
1
vote
1answer
64 views
facet_grid not working in ggplot for python?
I want to create plots based upon summary statistics rather than letting ggplot aggregate for me. After trying and failing with geom_violin() I finally settled on calculating percentiles and creating ...
0
votes
1answer
51 views
Not able to import ggplot in python 3.5
I have Ubuntu Gnome 16.04 both python 2.7 and python 3.5 installed.
I have installed ggplot in python 3.5 but not able to import it.
I am getting ImportError: No module named 'StringIO'.
Am I ...
0
votes
1answer
78 views
Python 3.5 Windows cannot run Rodeo example?
I just installed Python 3.5 on windows 10 and was trying to run the startup example from the IDE I choose (Rodeo). The example gives an error when trying to import ggplot. Specifically, at this call
...
0
votes
0answers
24 views
Rotate xlabels from scale_x_discrete in ggplot
I have a dataframe I would like to plot using ggplot, my current code looks like this:
df = pd.DataFrame(...)
# Change the "month" column to a Categorical column and add a new column for id (plot)
...
3
votes
2answers
5k views
Is there a way to plot a pandas series in ggplot?
I'm experimenting with pandas and non-matplotlib plotting. Good suggestions are here. This question regards yhat's ggplot and I am running into two issues.
Plotting a series in pandas is easy.
...
0
votes
0answers
26 views
IO Error when I attempt to import ggplot using ipython (2.7)
ggplot is installed, however I receive the following error when I try to import it using Ipython. I'm using python 2.7.
from ggplot import *
IOError Traceback (...
1
vote
0answers
33 views
ggplot aes fill uses only one color
I recently had to reformat my system at work and after reinstalling anaconda and ggplot I am observing some funny behavior for graphs.
The anaconda environment has the default packages and ggplot ...
1
vote
1answer
91 views
Python 3.5 Jupyter Notebook ggplot “name error”
I am getting NameError: name 'unicode' is not defined when using yHat's ggplot library for Python (see full error below) in a Jupyter Notebook, running Python 3.5.2. with the following import ...
0
votes
0answers
28 views
Draw 2 geom_line() with ggplot
Simple.csv:
"","teamID","yearID","HR"
"1320","LAN",1958,172
"1325","SFN",1958,170
"1336","LAN",1959,148
"1341","SFN",1959,167
"1352","LAN",1960,126
"1357","SFN",1960,130
"1369","LAN",1961,157
"1375","...
0
votes
0answers
27 views
How to set colormap for python ggplot?
I am starting to use the ggplot package for python to improve my plotting aesthetics. Specifically, I'm creating a scatter plot to demonstrate the outputs of a machine learning classifier in a ...
0
votes
1answer
154 views
Module ggplot installed but cannot be imported
I installed ggplot for python 2.7 in a Win64 env using conda via the command line:
$conda install -c https://conda.binstar.org/bokeh ggplot
since:
$pip install -U ggplot
could not locate the ...
0
votes
2answers
195 views
Group Bar Chart with Seaborn/Matplotlib
My goal is to create a grouped bar chart like the one below, using a pandas DataFrame that is grouped by two variables "Alpha" and "Beta."
xl2 = xl.groupby(['Alpha','Beta']).median()
When I tried ...
1
vote
0answers
27 views
“scale_color_gradient” in ggplot Python is not working?
everytime i try this it does not work the normal plot is what i see
i tried to search about it but there is no problem like mine
gg = ggplot(d,aes('x', 'y',color = 'x')) + geom_point() +
...
7
votes
2answers
130 views
ggplot python handling time data over many weeks at hourly resolution
I am plotting journey time for a series of roads at hourly resolution, with data over a few weeks.
I can plot using unix time, but that isn't very intuitive. This is 7 days worth of data.
I used ...
0
votes
0answers
13 views
Geom point color setting, not effective with ggplot color setting
I am trying to make a ggplot of below data using python ggplot library,
I used the following code for same -
def EntriesHourlyBasedOntempratures():
df = pandas.read_csv(r'D:\Personal\BigData\...
5
votes
2answers
131 views
Is it possible to turn off the GUI displayed while plotting (ggplot) in Python?
Here is the code I have tried,
print ggplot(data, aes('Age', 'Weight')) + geom_point(colour='steelblue')
When I execute this, it opens up a new GUI (like below) displaying the plot.
Now, my ...
3
votes
1answer
3k views
Python: How can I use ggplot with a simple 2 column array?
I try to use ggplot for python I have the following data:
power_data = [[ 4.13877565e+04, 2.34652000e-01],
[ 4.13877565e+04, 2.36125000e-01],
[ 4.13877565e+04, 2.34772000e-01],
...
[ 4....
0
votes
0answers
25 views
Python, ggplot: axis' vertical labels do not fit
Let's say I have the following dictionary:
d = {'beryllium chloride': 4, 'diphosphorus pentoxide': 7, \
'aluminum carbonate': 2, 'ammonium phosphate': 9, \
'sulfur dioxide': 13}
And I ...
1
vote
1answer
2k views
pandas - multi index plotting
I have some data where I've manipulated the dataframe using the following code:
import pandas as pd
import numpy as np
data = pd.DataFrame([[0,0,0,3,6,5,6,1],[1,1,1,3,4,5,2,0],[2,1,0,3,6,5,6,1],[3,0,...
0
votes
1answer
47 views
yhat ggplot facet_wrap type error
I have a pandas dataframe that I read in via txt file:
training = pd.read_csv('training_data.txt')
These are the columns:
>> print training.columns.values
['segment' 'cookie_id' '...
0
votes
0answers
65 views
issue with geom_histogram with ggplot2 (version 2.0.0)
following code works with,
Python 2.7
rpy 2.5.6
ggplot2 1.0.0
but breaks for,
Python 3.5.1
rpy 2.7.8
ggplot2 2.0.0
ggplot2.ggplot(data=rpy2.robjects.conversion.py2ri(df)) + \
ggplot2.aes_string(x=...
0
votes
1answer
119 views
Unable to import ggplot in python 3.5
i am unable to import ggplot in python 3.5. Can any body help me out on this? i think i have to install through pip install but do not know how to do it.
Below is the error.
ImportError: No module ...
0
votes
1answer
49 views
python's ggplot does not use year number as label on axis
In the following MWE, my year variable is shown on the x-axis as 0 to 6 instead of the actual year number. Why is this?
import pandas as pd
from pandas_datareader import wb
from ggplot import *
dat =...
0
votes
1answer
282 views
Getting insecure pickle string with ggplot
I'm trying to use ggplot for Python working inside iPython Notebook, but when running from ggplot import * the following error appears:
----------------------------------------------------------------...
0
votes
1answer
138 views
save a figure with ggplot library to jpg file
The GGplot documentation seems to indicate you can save a figure as jpg by using the device paramter, however when I try to use it I get the error: Exception, `
unknown format jpg.
def chart(...
1
vote
1answer
416 views
Matplotlib: Overriding “ggplot” default style properties
I am using matplotlibs ggplot style for plotting and want to overide only specific standard parameters such as the color of the xticklabels, grid background color and linewidth.
import numpy as np
...
2
votes
0answers
53 views
x axis value not correct for ggplot scatter plot with a single point
I'm using ggplot with a pandas dataframe to produce a scatter plot with a coloured factor. It's working as expected for multiple points but when I have a single point as input the x axis value is not ...
2
votes
1answer
1k views
Why Python ggplot returns name 'aes' is not defined?
When I use the following comand
p = ggplot(aes(x='DTM',y='TMP1'), data=data)
I get the following error
NameError: name 'aes' is not defined
Could you help me?
3
votes
1answer
139 views
Changing axis label size in Python ggplot
In R:
p + theme(axis.title = element_text(size = 12))
How can you do this in the Python implementation?
Note: I can't find a comprehensive source of documentation for ggplot in Python, which ...
0
votes
1answer
157 views
why won't geom_bar() change fill color like it's supposed to in python ggplot?
I'm trying to follow the demo here: http://blog.yhat.com/posts/aggregating-and-plotting-time-series-in-python.html and am unable to reproduce the figure
mine looks like this:
I'm using Win 8 ...
2
votes
1answer
102 views
Is python ggplot still being developed?
Python ggplot is great, but missing many customization options.
The commit history on github for the past year does not look very promising...
Does anyone know if it is still being developed?
0
votes
0answers
29 views
How to plot a gglplot graph with a color groups, but a single smooth line
I'd like to plot a graph in ggplot where the points are colored in groups, but there is a single smooth line. What I try to do is this, but it does not work:
print ggplot(aes(x='index', y='...
0
votes
0answers
49 views
ggplot geombar or geomhistogram in Python. Graph has gaps in each bar
Here is the code for this geombar
gg1 = ggplot(aes(y='y', x='x'), data=new_data) +
geom_bar(stat="identity") +
labs(x="Hour of day",y="Hourly entries") +
ggtitle("Riders per a hour of ...
0
votes
1answer
64 views
How to plot Japanese string-based data in Python
I have a csv like this:
Date, i, eat, chicken, you, fish, banana
2014-9-14, 1, 2, 1, 1, 1, 0
2014-10-15, 1, 1, 1, 0, 0, 0
2014-11-13, 0, 1, 0, 1, 0, 1
Forget about upper/lowercase and stemming ...
2
votes
0answers
1k views
Adjusting axis range and tick marks in python ggplot
Is there a way to be able to set both the axis range and the number of tick marks in the python implementation of ggplot for a scatterplot? For example, I want to set the y-axis to be from 0 to 100 ...
-1
votes
1answer
280 views
Installing of python ggplot fails on ubuntu 14.04
The installing of ggplot fails with the following output:
user@CompA:~$ sudo pip install -U ggplot
Downloading/unpacking ggplot
Downloading ggplot-0.6.8.tar.gz (8.5MB): 8.5MB downloaded
Running ...
0
votes
1answer
224 views
How to change colors of points in Python's ggplot
I'm trying to figure out how to change the colors that ggplot produces on my plot. In label, I have 4 categories - 0, 1, 2, 3. Currently ggplot colors these as purple, green, and red, but I would like ...
0
votes
1answer
178 views
installing ggplot for python on windows10 64
I am using python 2.7 and installed the anaconda installations too.
although I am novice user, but everything is working fine.
Then I decided to use the ggplot. (yhat package for python)
...
1
vote
1answer
68 views
Adding errorbars in ggplot Python
Can't find a way of adding errorbars to a Python ggplot plot. The following issue has been neglected for over a year. Nothing in the docs.
1
vote
1answer
45 views
How to have multiple graphs in one figure in ggplot
I would like to have multiple graphs in one figure using ggplot. Much like a subplot in matplotlib.