yhat / ggpy

ggplot port for python
http://yhat.github.io/ggpy/
BSD 2-Clause "Simplified" License
3.7k stars 572 forks source link

Hiding legend #629

Open jbrownuf07 opened 6 years ago

jbrownuf07 commented 6 years ago

I'm just converting over from R to Python and was comforted to see the ggplot2 goodness. As I'm just getting started, I'm having a problem hiding the legend in a line plot:

import pandas as pd
meat_lng = pd.melt(meat, id_vars=['date'])
ggplot(meat_lng, aes(x='date', y='value', color='variable')) + geom_line()  + theme(legend_position='none')

I get the warning RuntimeWarning: legend_position is an invalid theme parameter, so I'm not sure if this is a bug or if there's a different way to hide the legend in Python?

Thanks, Joe

agladstein commented 6 years ago

I am also having the same issue. I also tried guides(colour=FALSE), but got an error. How do you hide the legend?

def lineplot_estimate_dist(param, combined_PosteriorCharacteristics_observed_df, y_axis_name):
    plot = ggplot(aes(x = 'chr', y = y_axis_name, colour='obs'), data = combined_PosteriorCharacteristics_observed_df) + \
        geom_point() + \
        geom_line() + \
        guides(colour=FALSE) +\
        theme_bw()
    return plot

NameError: name 'guides' is not defined