Label on the x and y axes

28 views
Skip to first unread message

balachmar

unread,
Jun 23, 2009, 8:37:12 AM6/23/09
to CairoPlot
Hi,

I am using the current trunk version (because I need a legend) and I
want to add labels to the x and y axis. Describing the values on the
axis. For instance if the x axis depicts time, then the values are
just numerical values and the the x axis label would be Time (s) .
I cannot seem to find this basic functionality.
Could someone explain to me how to do it, or else maybe point me in
the direction where to start coding. Because I like this project and I
feel this feature needs to be implemented.

Cheers,

balachmar

Rodrigo Araújo

unread,
Jun 23, 2009, 8:44:25 AM6/23/09
to cair...@googlegroups.com
Hello Balachmar,

Could you clarify which plotting class are you using?
If it's ScatterPlot, DotLinePlot or FunctionPlot, you can use the x_title and y_title parameters. Check this example:

data = { "john" : [-5, -2, 0, 1, 3], "mary" : [0, 0, 3, 5, 2], "philip" : [-2, -3, -4, 2, 1] }
x_labels = [ "jan/2008", "feb/2008", "mar/2008", "apr/2008", "may/2008" ]
y_labels = [ "very low", "low", "medium", "high", "very high" ]
cairoplot.dot_line_plot( "dot_line_2_dictionary_labels", data, 400, 300, x_labels = x_labels, 
                         y_labels = y_labels, axis = True, grid = True,
                         x_title = "title x axis", y_title = "title y axis", series_legend=True )

Also, thanks for the interest!
Cheers,

Rodrigo

balachmar

unread,
Jun 25, 2009, 8:33:34 AM6/25/09
to CairoPlot
I am using the DotLinePlot, and it works, however it puts the titles
at the opposite sides. So x at the top and y to the right. This is not
as expected.

Cheers,

balachmar

On Jun 23, 2:44 pm, Rodrigo Araújo <alf.rodr...@gmail.com> wrote:
> Hello Balachmar,
>
> Could you clarify which plotting class are you using?If it's ScatterPlot,

Rodrigo Araújo

unread,
Jun 25, 2009, 8:38:50 AM6/25/09
to cair...@googlegroups.com
Yeah,

By the time we coded this, I tested many options and the better looking one was that solution.
Would you rather see the axis titles below the legends (on the left for the y axis and on the bottom for the x axis)?

Cheers,

Rodrigo

balachmar

unread,
Jun 25, 2009, 8:57:10 AM6/25/09
to CairoPlot
Yes, that is the solution that is most general.
The titles are normally next to the axis. (As you proposed)
Then you can also have a main title that is above the graph.

I have tried hacking to code to make it work, and for the x axis it
works but the y axis is a bit more difficult. When could you have
fixed this? Because the I will update my version using bzr.

Thanks in advance,

balachmar

Great response speed by the way!

On Jun 25, 2:38 pm, Rodrigo Araújo <alf.rodr...@gmail.com> wrote:
> Yeah,
> By the time we coded this, I tested many options and the better looking one
> was that solution.
> Would you rather see the axis titles below the legends (on the left for the
> y axis and on the bottom for the x axis)?
>
> Cheers,
>
> Rodrigo
>

Rodrigo Araújo

unread,
Jun 25, 2009, 9:01:29 AM6/25/09
to cair...@googlegroups.com
I have some other priorities on the code these days, which include merging Magnun's and Paul's branches and releasing version 2.0

It will take at least a month for me to finish it all, so I don't actually know when will I be able to check that out. How bad do you need this?

balachmar

unread,
Jun 25, 2009, 9:29:47 AM6/25/09
to CairoPlot
Bad enough to fix my hacking earlier than within a month.
As I said the x axis label I can already position correctly. It won't
take too long to do the same for the y axis.
If you want I can send the patch.

Cheers,

balachmar

On Jun 25, 3:01 pm, Rodrigo Araújo <alf.rodr...@gmail.com> wrote:
> I have some other priorities on the code these days, which include merging
> Magnun's and Paul's branches and releasing version 2.0
> It will take at least a month for me to finish it all, so I don't actually
> know when will I be able to check that out. How bad do you need this?
>

Rodrigo Araújo

unread,
Jun 25, 2009, 9:33:12 AM6/25/09
to cair...@googlegroups.com
Sure I'd want.
Another option, which might be quicker depending on the amount of graphics you need to generate, is to output the graphics as .svg files and edit them on InkScape to add the axis titles wherever you want.

Thanks,

Rodrigo

Magnun Leno

unread,
Jun 25, 2009, 4:04:11 PM6/25/09
to cair...@googlegroups.com
Just a little correction... Releasing version 1.2. The 2.0 version will have major differences and will reduce the number of arguments in the plot functions.

Maybe would be more intersting to make the position for the axis labels optional.

Att,
Magnun Leno

balachmar

unread,
Jun 29, 2009, 4:05:22 AM6/29/09
to CairoPlot
Bug report + fix send to launchpad.

Cheers,

balachmar

On Jun 25, 10:04 pm, Magnun Leno <magnun.l...@gmail.com> wrote:
> Just a little correction... Releasing version 1.2. The 2.0 version will have
> major differences and will reduce the number of arguments in the plot
> functions.
>
> Maybe would be more intersting to make the position for the axis labels
> optional.
>
> Att,
> Magnun Leno
>
> On Thu, Jun 25, 2009 at 10:01 AM, Rodrigo Araújo <alf.rodr...@gmail.com>wrote:
>
> > I have some other priorities on the code these days, which include merging
> > Magnun's and Paul's branches and releasing version 2.0
> > It will take at least a month for me to finish it all, so I don't actually
> > know when will I be able to check that out. How bad do you need this?
>
Reply all
Reply to author
Forward
0 new messages