python - changing x-axis tick labels using ggplot -


i using ggplot plot histogram x variable categorical variable , want change x-axis tick labels. here code:

from pandas import * ggplot import *  df = pandas.read_csv('c:\users\...csv')  def plot_data(df):      plot = ggplot(data_by_group, aes('x', 'y')) +            geom_histogram(stat='bar') + ggtitle('title') +             xlab('x-label') + ylab('y-label')       #x_ticklabels = ['a', 'b', 'c']         return plot 

i use x_ticklabels on x-axis instead of numbers categorical variable.

any ideas on how this?

thank you

there example here (under "setting tick mark labels") showing how this. briefly, given ggplot "bp", can control actual tick labels setting labels each category have in data this:

bp + scale_x_discrete(breaks=c("ctrl", "trt1", "trt2"),                   labels=c("control", "treat 1", "treat 2")) 

so in case, imagine in lines of

plot = ggplot(data_by_group, aes('x', 'y')) +        geom_histogram(stat='bar') + ggtitle('title') +         xlab('x-label') + ylab('y-label') +        scale_x_discrete(breaks=c(1, 2, 3),                   labels=c("a", "b", "c")) 

Comments

Popular posts from this blog

android - Pass an Serializable object in AIDL -

php - Improving script execution time -

How to provide Authorization & Authentication using Asp.net, C#? -