Questions tagged [python-ggplot]

A python plotting library emulating R's ggplot2.

A python plotting library emulating R's ggplot2. https://github.com/yhat/ggpy

205 questions
21
votes
5 answers

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 ggplot import * ImportError: cannot import name…
Krantz
  • 1,424
  • 1
  • 12
  • 31
14
votes
1 answer

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 with a tick at values 0, 10, 20, 30,...,100. I've…
plam
  • 1,305
  • 3
  • 15
  • 24
14
votes
1 answer

Documentation and syntax for ggplot in python

Does anybody know of documentation of ggplot2 in python? To my knowledge the syntax is similar to R syntax, but is there any information or code examples out there yet? Any tutorials....?
jonas
  • 13,559
  • 22
  • 57
  • 75
13
votes
1 answer

Python ggplot rotate axis labels

when I tried to plot a timeseries with ggplot, the x axis lables became too crowded and overlapped each other: The code is: plot = ggplot(df, aes(x=df.index, weight='COUNT')) + \ geom_bar() + \ xlab('Date') + \ ylab('Incidents') I…
xiaolong
  • 3,396
  • 4
  • 31
  • 46
11
votes
4 answers

ggplot in python: plot size and color

Folks, I'm trying to use ggplot in python. from ggplot import * ggplot(diamonds, aes(x='price', fill='cut')) + geom_density(alpha=0.25) + facet_wrap("clarity") Couple things I am trying to do: 1) I expected the color to be both filled and for the…
Trexion Kameha
  • 3,362
  • 10
  • 34
  • 60
11
votes
1 answer

How do I create a bar chart in python ggplot?

I'm using yhat's ggplot library. I have the following pandas DataFrame: degree observed percent observed expected percent expected 0 0 0 0.0 0 0.044551 1 1 1 0.1 …
Clay
  • 2,949
  • 3
  • 38
  • 54
10
votes
1 answer

Why is the plot generated from ggplot not showing up?

I am unable to display the plot from ggplot. I've tried something like import pandas as pd import pylab as plt import statsmodels.api as sm from ggplot import * df = pd.DataFrame.from_csv('file.csv',…
user4352158
  • 731
  • 4
  • 13
  • 24
8
votes
2 answers

How to make a scatter plot for clustering in Python

I am carrying out clustering and try to plot the result. A dummy data set is : data import numpy as np X = np.random.randn(10) Y = np.random.randn(10) Cluster = np.array([0, 1, 1, 1, 3, 2, 2, 3, 0, 2]) # Labels of cluster 0 to 3 cluster center …
Zelong
  • 2,476
  • 7
  • 31
  • 51
8
votes
1 answer

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?
Hugo
  • 1,558
  • 12
  • 35
  • 68
8
votes
2 answers

How to make a histogram in ipython notebook using ggplot2 (for python)

I'm trying to make a histogram of a simple list of numbers in python using ipython notebook and ggplot for python. Using pylab, it's easy enough, but I cannot get ggplot to work. I'm using this code (based on the diamond histogram example, which…
Amandasaurus
  • 58,203
  • 71
  • 188
  • 248
7
votes
2 answers

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 a function to manipulate the time field in order to…
LearningSlowly
  • 8,641
  • 19
  • 55
  • 78
7
votes
1 answer

Plotting one scatterplot with multiple dataframes with ggplot in python

I am trying to get data from two separate dataframes onto the same scatterplot. I have seen solutions in R that use something like: ggplot() + geom_point(data = df1, aes(df1.x,df2.y)) + geom_point(data = df2,aes(df2.x, df2.y)) But in python, with…
scld
  • 173
  • 1
  • 6
7
votes
3 answers

Accessing axis or figure in python ggplot

python ggplot is great, but still new, and I find the need to fallback on traditional matplotlib techniques to modify my plots. But I'm not sure how to either pass an axis instance to ggplot, or get one back from it. So let's say I build a plot…
Aman
  • 45,819
  • 7
  • 35
  • 37
6
votes
1 answer

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 import pandas as pd import matplotlib # changing…
Cord Kaldemeyer
  • 6,405
  • 8
  • 51
  • 81
6
votes
2 answers

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.13882896e+04, 2.29006000e-01], [ 4.13882896e+04, …
Eduard Florinescu
  • 16,747
  • 28
  • 113
  • 179
1
2 3
13 14