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

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

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

How to use Authorization & Authentication in Asp.net, C#? -