multiple or stacked axes in a Chaco plot

classic Classic list List threaded Threaded
11 messages Options
Reply | Threaded
Open this post in threaded view
|

multiple or stacked axes in a Chaco plot

Brennan Williams
I've been looking at Bryce's stacked_axis.py Chaco example to try and
add additional axes to the left and right of my Chaco plots.
See attached for where I've got to so far.

I have a couple of issues that you may be able to help me with, probably
to do with how I'm using containers.
I'm going to remove the borders around the outside of each axis as they
are going through the axis titles. My left hand axes look ok with the
tick labels on the lhs and the axis title to the left. On the righ hand
axes however my ticl labels are ok (to the right) but my axis title is
still to the left and the text is going up the screen rather than down.

As you can see I've got a left and right hand axis attached to my plot
so you can see how the additional right hand axes should look.

My other main problem is how to get the axes to vertically line up with
my plot. I have the 2 extra left axes in an HPlotContainer and the 2
extra right axes in a separate HPlotContainer. My actual line plots with
the title above the plot, the top and bottom x xaxes and the left and
right y axes are all in a "Plot".

So I have something like....
self.leftaxescontainer=HPlotContainer()
self.rightaxescontainer=HPlotContainer()
self.plot1=Plot(...)
....
code for creating the plots and axes and putting them in the containers
above....
.....

self.gridcontainer=HPlotContainer()
self.gridcontainer.add(self.leftaxescontainer)
self.gridcontainer.add(self.plot1)
self.gridcontainer.add(self.rightaxescontainer)

and that gets me what you see in my screenshot. So it's not quite the
same as the stacked_axis.py demo where the axes do line up. However that
demo doesn't use Plot and it also doesn't have a title - I think those
are the two issues causing my problem.

I'm thinking of stripping out my use of Plot and replacing it with
create_line_plot and create_scatter_plot and adding everything into one
container. Not sure how I'm going to handle adding a title to that as
I'm not sure yet what Plot does under the hood with the title text.

Any pointers on which is the best way to go?

Thanks

Brennan


_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev

multipleaxes.png (70K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: multiple or stacked axes in a Chaco plot

Brennan Williams
I've got a bit closer to setting up multiple axes on both the left and the right hand sides of a plot - see attached screenshot.

Unlike the screenshot in my previous posting I now have the left and right axes correctly aligned with the plot.

Each of the axes is a PlotAxis while the line plots are created using create_line_plot and are added to an OverlayPlotContainer.

An HPlotContainer is then created to which is added (in order) the left axes, the OverlayPlotContainer and then the right axes....

plot_area=OverlayPlotContainer(bgcolor="transparent)
bigcontainer=HPlotContainer()
leftaxeslist=[]
rightaxeslist=[]

for item in plotitemlist:
    renderer=create_line_plot(....)
    plot_area.add(renderer)
    axis=PlotAxis(....)
    if left:
      leftaxislist.append(axis)
    else:
      rightaxislist.append(axis)   

for axis in leftaxislist:
    bigcontainer.add(axis)
bigcontainer.add(plot_area)
for axis in rightaxislist:
    bigcontainer.add(axis)


The remaining problem I have is the orientation and positioning of the axis titles on the rhs axes.
The axes are created using...

 yaxis=PlotAxis(
                    title=axistitle,
                    resizable='v',
                    mapper=renderer.y_mapper,
                    tick_label_formatter=lambda val: "%0.5g"%val,
                    orientation=ps.axisorientation,
                    axis_line_color=vcolour,
                    tick_color=vcolour,
                    tick_label_color=vcolour,
                    title_color=vcolour,
                    bgcolor="white",
                    border_visible=False)

where the orientation is either "left" or "right".

The left axes are ok, tick mark labels are to the left, axis title is offset a little bit more to the left and the text goes up vertically

With the right axes the tock mark labels are ok, i.e. they are to the right but the axis title is incorrectly positioned.

So I'm not sure how I can correctly set or override the positioning of the right axis title. "orientation" doesnt seem to be doing it.
I looked at the documentation for PlotAxis and the title attribute is defined as....

title = Trait('?', PlotLabel, Str, Unicode, label = 'Title')

which I don't think I'm interpreting correctly. If I set title to be a text string that is fine, I get that string plotted,
albeit in the wrong place so I thought I would try setting title to be a PlotLabel...

yaxis.title=PlotLabel('my title',alignment=45)

but that causes an error saying it has to be a Str or Unicode.

I tried wrapping it with Trait...

yaxis.title=Trait(PlotLabel('my title',alignment=45))

but got the same error.


Any ideas on what I need to do? Once I've got it working correctly I'll put together a "multiple_left_and_right_axes.py" 
example to go with stacked_axis.py
Regards Brennan

On 13/05/2011 11:58 a.m., Brennan Williams wrote:
I've been looking at Bryce's stacked_axis.py Chaco example to try and add additional axes to the left and right of my Chaco plots.
See attached for where I've got to so far.

I have a couple of issues that you may be able to help me with, probably to do with how I'm using containers.
I'm going to remove the borders around the outside of each axis as they are going through the axis titles. My left hand axes look ok with the tick labels on the lhs and the axis title to the left. On the righ hand axes however my ticl labels are ok (to the right) but my axis title is still to the left and the text is going up the screen rather than down.

As you can see I've got a left and right hand axis attached to my plot so you can see how the additional right hand axes should look.

My other main problem is how to get the axes to vertically line up with my plot. I have the 2 extra left axes in an HPlotContainer and the 2 extra right axes in a separate HPlotContainer. My actual line plots with the title above the plot, the top and bottom x xaxes and the left and right y axes are all in a "Plot".

So I have something like....
self.leftaxescontainer=HPlotContainer()
self.rightaxescontainer=HPlotContainer()
self.plot1=Plot(...)
....
code for creating the plots and axes and putting them in the containers above....
.....

self.gridcontainer=HPlotContainer()
self.gridcontainer.add(self.leftaxescontainer)
self.gridcontainer.add(self.plot1)
self.gridcontainer.add(self.rightaxescontainer)

and that gets me what you see in my screenshot. So it's not quite the same as the stacked_axis.py demo where the axes do line up. However that demo doesn't use Plot and it also doesn't have a title - I think those are the two issues causing my problem.

I'm thinking of stripping out my use of Plot and replacing it with create_line_plot and create_scatter_plot and adding everything into one container. Not sure how I'm going to handle adding a title to that as I'm not sure yet what Plot does under the hood with the title text.

Any pointers on which is the best way to go?

Thanks

Brennan

_______________________________________________ Enthought-Dev mailing list [hidden email] https://mail.enthought.com/mailman/listinfo/enthought-dev


_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev

mutplieaxes.png (103K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: multiple or stacked axes in a Chaco plot

John Wiggins
Hello Brennan,

What happens if you modify the stacked_axis.py example so that the
orientation is right instead of left? That's working as expected on my
machine. (synced to the HEAD of branch old-namespace)
As for the title attribute, the version that I have looks like this:
    title = Trait('', Str, Unicode) #May want to add PlotLabel option
Where is the documentation that said it was Trait('?', PlotLabel, Str,
Unicode, label = 'Title')? That should really be updated.

- John

On Mon, May 16, 2011 at 10:35 PM, Brennan Williams
<[hidden email]> wrote:

> I've got a bit closer to setting up multiple axes on both the left and the
> right hand sides of a plot - see attached screenshot.
>
> Unlike the screenshot in my previous posting I now have the left and right
> axes correctly aligned with the plot.
>
> Each of the axes is a PlotAxis while the line plots are created using
> create_line_plot and are added to an OverlayPlotContainer.
>
> An HPlotContainer is then created to which is added (in order) the left
> axes, the OverlayPlotContainer and then the right axes....
>
> plot_area=OverlayPlotContainer(bgcolor="transparent)
> bigcontainer=HPlotContainer()
> leftaxeslist=[]
> rightaxeslist=[]
>
> for item in plotitemlist:
>     renderer=create_line_plot(....)
>     plot_area.add(renderer)
>     axis=PlotAxis(....)
>     if left:
>       leftaxislist.append(axis)
>     else:
>       rightaxislist.append(axis)
>
> for axis in leftaxislist:
>     bigcontainer.add(axis)
> bigcontainer.add(plot_area)
> for axis in rightaxislist:
>     bigcontainer.add(axis)
>
>
> The remaining problem I have is the orientation and positioning of the axis
> titles on the rhs axes.
> The axes are created using...
>
>  yaxis=PlotAxis(
>                     title=axistitle,
>                     resizable='v',
>                     mapper=renderer.y_mapper,
>                     tick_label_formatter=lambda val: "%0.5g"%val,
>                     orientation=ps.axisorientation,
>                     axis_line_color=vcolour,
>                     tick_color=vcolour,
>                     tick_label_color=vcolour,
>                     title_color=vcolour,
>                     bgcolor="white",
>                     border_visible=False)
>
> where the orientation is either "left" or "right".
>
> The left axes are ok, tick mark labels are to the left, axis title is offset
> a little bit more to the left and the text goes up vertically
>
> With the right axes the tock mark labels are ok, i.e. they are to the right
> but the axis title is incorrectly positioned.
>
> So I'm not sure how I can correctly set or override the positioning of the
> right axis title. "orientation" doesnt seem to be doing it.
> I looked at the documentation for PlotAxis and the title attribute is
> defined as....
>
> title = Trait('?', PlotLabel, Str, Unicode, label = 'Title')
>
> which I don't think I'm interpreting correctly. If I set title to be a text
> string that is fine, I get that string plotted,
> albeit in the wrong place so I thought I would try setting title to be a
> PlotLabel...
>
> yaxis.title=PlotLabel('my title',alignment=45)
>
> but that causes an error saying it has to be a Str or Unicode.
>
> I tried wrapping it with Trait...
>
> yaxis.title=Trait(PlotLabel('my title',alignment=45))
>
> but got the same error.
>
>
> Any ideas on what I need to do? Once I've got it working correctly I'll put
> together a "multiple_left_and_right_axes.py"
> example to go with stacked_axis.py
>
> Regards
>
> Brennan
>
> On 13/05/2011 11:58 a.m., Brennan Williams wrote:
>
> I've been looking at Bryce's stacked_axis.py Chaco example to try and add
> additional axes to the left and right of my Chaco plots.
> See attached for where I've got to so far.
>
> I have a couple of issues that you may be able to help me with, probably to
> do with how I'm using containers.
> I'm going to remove the borders around the outside of each axis as they are
> going through the axis titles. My left hand axes look ok with the tick
> labels on the lhs and the axis title to the left. On the righ hand axes
> however my ticl labels are ok (to the right) but my axis title is still to
> the left and the text is going up the screen rather than down.
>
> As you can see I've got a left and right hand axis attached to my plot so
> you can see how the additional right hand axes should look.
>
> My other main problem is how to get the axes to vertically line up with my
> plot. I have the 2 extra left axes in an HPlotContainer and the 2 extra
> right axes in a separate HPlotContainer. My actual line plots with the title
> above the plot, the top and bottom x xaxes and the left and right y axes are
> all in a "Plot".
>
> So I have something like....
> self.leftaxescontainer=HPlotContainer()
> self.rightaxescontainer=HPlotContainer()
> self.plot1=Plot(...)
> ....
> code for creating the plots and axes and putting them in the containers
> above....
> .....
>
> self.gridcontainer=HPlotContainer()
> self.gridcontainer.add(self.leftaxescontainer)
> self.gridcontainer.add(self.plot1)
> self.gridcontainer.add(self.rightaxescontainer)
>
> and that gets me what you see in my screenshot. So it's not quite the same
> as the stacked_axis.py demo where the axes do line up. However that demo
> doesn't use Plot and it also doesn't have a title - I think those are the
> two issues causing my problem.
>
> I'm thinking of stripping out my use of Plot and replacing it with
> create_line_plot and create_scatter_plot and adding everything into one
> container. Not sure how I'm going to handle adding a title to that as I'm
> not sure yet what Plot does under the hood with the title text.
>
> Any pointers on which is the best way to go?
>
> Thanks
>
> Brennan
>
>
> _______________________________________________
> Enthought-Dev mailing list
> [hidden email]
> https://mail.enthought.com/mailman/listinfo/enthought-dev
>
>
> _______________________________________________
> Enthought-Dev mailing list
> [hidden email]
> https://mail.enthought.com/mailman/listinfo/enthought-dev
>
>
_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev
Reply | Threaded
Open this post in threaded view
|

Re: multiple or stacked axes in a Chaco plot

bryce hendrix-2
In reply to this post by Brennan Williams
Brennan,

I think the attributes you're looking for are tick_label_position and tick_label_offset, and maybe ensure_labels_bounded. Tick label layout is one of those areas of Chaco that no one is very proud of. Hopefully with these attributes you can coerce what you're looking for.

So, that said- we've had several discussions about plot axis lately. I'm of the opinion that we redo the whole thing. The process of attaching axis as underlays requires the user to know way too much about the Chaco internals. IMO you should be able to create a lightweight axis object and attach it to either the left or right of the plot and let Chaco worry about where and how to render it.

Bryce

On Mon, May 16, 2011 at 10:35 PM, Brennan Williams <[hidden email]> wrote:
I've got a bit closer to setting up multiple axes on both the left and the right hand sides of a plot - see attached screenshot.

Unlike the screenshot in my previous posting I now have the left and right axes correctly aligned with the plot.

Each of the axes is a PlotAxis while the line plots are created using create_line_plot and are added to an OverlayPlotContainer.

An HPlotContainer is then created to which is added (in order) the left axes, the OverlayPlotContainer and then the right axes....

plot_area=OverlayPlotContainer(bgcolor="transparent)
bigcontainer=HPlotContainer()
leftaxeslist=[]
rightaxeslist=[]

for item in plotitemlist:
    renderer=create_line_plot(....)
    plot_area.add(renderer)
    axis=PlotAxis(....)
    if left:
      leftaxislist.append(axis)
    else:
      rightaxislist.append(axis)   

for axis in leftaxislist:
    bigcontainer.add(axis)
bigcontainer.add(plot_area)
for axis in rightaxislist:
    bigcontainer.add(axis)


The remaining problem I have is the orientation and positioning of the axis titles on the rhs axes.
The axes are created using...

 yaxis=PlotAxis(
                    title=axistitle,
                    resizable='v',
                    mapper=renderer.y_mapper,
                    tick_label_formatter=lambda val: "%0.5g"%val,
                    orientation=ps.axisorientation,
                    axis_line_color=vcolour,
                    tick_color=vcolour,
                    tick_label_color=vcolour,
                    title_color=vcolour,
                    bgcolor="white",
                    border_visible=False)

where the orientation is either "left" or "right".

The left axes are ok, tick mark labels are to the left, axis title is offset a little bit more to the left and the text goes up vertically

With the right axes the tock mark labels are ok, i.e. they are to the right but the axis title is incorrectly positioned.

So I'm not sure how I can correctly set or override the positioning of the right axis title. "orientation" doesnt seem to be doing it.
I looked at the documentation for PlotAxis and the title attribute is defined as....

title = Trait('?', PlotLabel, Str, Unicode, label = 'Title')

which I don't think I'm interpreting correctly. If I set title to be a text string that is fine, I get that string plotted,
albeit in the wrong place so I thought I would try setting title to be a PlotLabel...

yaxis.title=PlotLabel('my title',alignment=45)

but that causes an error saying it has to be a Str or Unicode.

I tried wrapping it with Trait...


yaxis.title=Trait(PlotLabel('my title',alignment=45))

but got the same error.


Any ideas on what I need to do? Once I've got it working correctly I'll put together a "multiple_left_and_right_axes.py" 
example to go with stacked_axis.py
Regards Brennan

On 13/05/2011 11:58 a.m., Brennan Williams wrote:
I've been looking at Bryce's stacked_axis.py Chaco example to try and add additional axes to the left and right of my Chaco plots.
See attached for where I've got to so far.

I have a couple of issues that you may be able to help me with, probably to do with how I'm using containers.
I'm going to remove the borders around the outside of each axis as they are going through the axis titles. My left hand axes look ok with the tick labels on the lhs and the axis title to the left. On the righ hand axes however my ticl labels are ok (to the right) but my axis title is still to the left and the text is going up the screen rather than down.

As you can see I've got a left and right hand axis attached to my plot so you can see how the additional right hand axes should look.

My other main problem is how to get the axes to vertically line up with my plot. I have the 2 extra left axes in an HPlotContainer and the 2 extra right axes in a separate HPlotContainer. My actual line plots with the title above the plot, the top and bottom x xaxes and the left and right y axes are all in a "Plot".

So I have something like....
self.leftaxescontainer=HPlotContainer()
self.rightaxescontainer=HPlotContainer()
self.plot1=Plot(...)
....
code for creating the plots and axes and putting them in the containers above....
.....

self.gridcontainer=HPlotContainer()
self.gridcontainer.add(self.leftaxescontainer)
self.gridcontainer.add(self.plot1)
self.gridcontainer.add(self.rightaxescontainer)

and that gets me what you see in my screenshot. So it's not quite the same as the stacked_axis.py demo where the axes do line up. However that demo doesn't use Plot and it also doesn't have a title - I think those are the two issues causing my problem.

I'm thinking of stripping out my use of Plot and replacing it with create_line_plot and create_scatter_plot and adding everything into one container. Not sure how I'm going to handle adding a title to that as I'm not sure yet what Plot does under the hood with the title text.

Any pointers on which is the best way to go?

Thanks

Brennan

_______________________________________________ Enthought-Dev mailing list [hidden email] https://mail.enthought.com/mailman/listinfo/enthought-dev


_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev



_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev
Reply | Threaded
Open this post in threaded view
|

Re: multiple or stacked axes in a Chaco plot

Brennan Williams
In reply to this post by John Wiggins
On 18/05/2011 2:32 a.m., John Wiggins wrote:
> Hello Brennan,
>
> What happens if you modify the stacked_axis.py example so that the
> orientation is right instead of left? That's working as expected on my
> machine. (synced to the HEAD of branch old-namespace)

It's been an interative process to get to where I currently am.
Initially I was trying to keep my existing use of  "Plot" and add in the
extra axes but then I replaced Plot with OverlayPlotContainer as in the
stacked_axis.py example but I had problems getting the axes to display -
they were in the HPlotContainer as I checked the components in each
container. Can't quite remember exactly what was going wrong, I may have
had a "component=renderer" line in my PlotAxis creation.

But anyway I got there in the end. My current problem is the
location/orientation of the title of the right had side axes. Are you
saying that you can run a modified stacked_axis.py with axes on the rhs
where the title is positioned correctly? If so, could you post/attach
that example so I can see what I'm doing wrong?
> As for the title attribute, the version that I have looks like this:
>      title = Trait('', Str, Unicode) #May want to add PlotLabel option
> Where is the documentation that said it was Trait('?', PlotLabel, Str,
> Unicode, label = 'Title')? That should really be updated.
>
http://code.enthought.com/projects/files/ets_api/enthought.chaco.plot_axis.PlotAxis.html

I found that doing a google on "Chaco PlotAxis". It does say ETS 2.7.1
at the top.

I see you are probably looking at...

http://code.enthought.com/projects/files/ETS32_API/enthought.chaco.axis.PlotAxis.html

so I need to make sure I'm in the ETS32_API tree and not the ets_api one.

Brennan

> - John
>
> On Mon, May 16, 2011 at 10:35 PM, Brennan Williams
> <[hidden email]>  wrote:
>> I've got a bit closer to setting up multiple axes on both the left and the
>> right hand sides of a plot - see attached screenshot.
>>
>> Unlike the screenshot in my previous posting I now have the left and right
>> axes correctly aligned with the plot.
>>
>> Each of the axes is a PlotAxis while the line plots are created using
>> create_line_plot and are added to an OverlayPlotContainer.
>>
>> An HPlotContainer is then created to which is added (in order) the left
>> axes, the OverlayPlotContainer and then the right axes....
>>
>> plot_area=OverlayPlotContainer(bgcolor="transparent)
>> bigcontainer=HPlotContainer()
>> leftaxeslist=[]
>> rightaxeslist=[]
>>
>> for item in plotitemlist:
>>      renderer=create_line_plot(....)
>>      plot_area.add(renderer)
>>      axis=PlotAxis(....)
>>      if left:
>>        leftaxislist.append(axis)
>>      else:
>>        rightaxislist.append(axis)
>>
>> for axis in leftaxislist:
>>      bigcontainer.add(axis)
>> bigcontainer.add(plot_area)
>> for axis in rightaxislist:
>>      bigcontainer.add(axis)
>>
>>
>> The remaining problem I have is the orientation and positioning of the axis
>> titles on the rhs axes.
>> The axes are created using...
>>
>>   yaxis=PlotAxis(
>>                      title=axistitle,
>>                      resizable='v',
>>                      mapper=renderer.y_mapper,
>>                      tick_label_formatter=lambda val: "%0.5g"%val,
>>                      orientation=ps.axisorientation,
>>                      axis_line_color=vcolour,
>>                      tick_color=vcolour,
>>                      tick_label_color=vcolour,
>>                      title_color=vcolour,
>>                      bgcolor="white",
>>                      border_visible=False)
>>
>> where the orientation is either "left" or "right".
>>
>> The left axes are ok, tick mark labels are to the left, axis title is offset
>> a little bit more to the left and the text goes up vertically
>>
>> With the right axes the tock mark labels are ok, i.e. they are to the right
>> but the axis title is incorrectly positioned.
>>
>> So I'm not sure how I can correctly set or override the positioning of the
>> right axis title. "orientation" doesnt seem to be doing it.
>> I looked at the documentation for PlotAxis and the title attribute is
>> defined as....
>>
>> title = Trait('?', PlotLabel, Str, Unicode, label = 'Title')
>>
>> which I don't think I'm interpreting correctly. If I set title to be a text
>> string that is fine, I get that string plotted,
>> albeit in the wrong place so I thought I would try setting title to be a
>> PlotLabel...
>>
>> yaxis.title=PlotLabel('my title',alignment=45)
>>
>> but that causes an error saying it has to be a Str or Unicode.
>>
>> I tried wrapping it with Trait...
>>
>> yaxis.title=Trait(PlotLabel('my title',alignment=45))
>>
>> but got the same error.
>>
>>
>> Any ideas on what I need to do? Once I've got it working correctly I'll put
>> together a "multiple_left_and_right_axes.py"
>> example to go with stacked_axis.py
>>
>> Regards
>>
>> Brennan
>>
>> On 13/05/2011 11:58 a.m., Brennan Williams wrote:
>>
>> I've been looking at Bryce's stacked_axis.py Chaco example to try and add
>> additional axes to the left and right of my Chaco plots.
>> See attached for where I've got to so far.
>>
>> I have a couple of issues that you may be able to help me with, probably to
>> do with how I'm using containers.
>> I'm going to remove the borders around the outside of each axis as they are
>> going through the axis titles. My left hand axes look ok with the tick
>> labels on the lhs and the axis title to the left. On the righ hand axes
>> however my ticl labels are ok (to the right) but my axis title is still to
>> the left and the text is going up the screen rather than down.
>>
>> As you can see I've got a left and right hand axis attached to my plot so
>> you can see how the additional right hand axes should look.
>>
>> My other main problem is how to get the axes to vertically line up with my
>> plot. I have the 2 extra left axes in an HPlotContainer and the 2 extra
>> right axes in a separate HPlotContainer. My actual line plots with the title
>> above the plot, the top and bottom x xaxes and the left and right y axes are
>> all in a "Plot".
>>
>> So I have something like....
>> self.leftaxescontainer=HPlotContainer()
>> self.rightaxescontainer=HPlotContainer()
>> self.plot1=Plot(...)
>> ....
>> code for creating the plots and axes and putting them in the containers
>> above....
>> .....
>>
>> self.gridcontainer=HPlotContainer()
>> self.gridcontainer.add(self.leftaxescontainer)
>> self.gridcontainer.add(self.plot1)
>> self.gridcontainer.add(self.rightaxescontainer)
>>
>> and that gets me what you see in my screenshot. So it's not quite the same
>> as the stacked_axis.py demo where the axes do line up. However that demo
>> doesn't use Plot and it also doesn't have a title - I think those are the
>> two issues causing my problem.
>>
>> I'm thinking of stripping out my use of Plot and replacing it with
>> create_line_plot and create_scatter_plot and adding everything into one
>> container. Not sure how I'm going to handle adding a title to that as I'm
>> not sure yet what Plot does under the hood with the title text.
>>
>> Any pointers on which is the best way to go?
>>
>> Thanks
>>
>> Brennan
>>
>>
>> _______________________________________________
>> Enthought-Dev mailing list
>> [hidden email]
>> https://mail.enthought.com/mailman/listinfo/enthought-dev
>>
>>
>> _______________________________________________
>> Enthought-Dev mailing list
>> [hidden email]
>> https://mail.enthought.com/mailman/listinfo/enthought-dev
>>
>>
> _______________________________________________
> Enthought-Dev mailing list
> [hidden email]
> https://mail.enthought.com/mailman/listinfo/enthought-dev
>

_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev
Reply | Threaded
Open this post in threaded view
|

Re: multiple or stacked axes in a Chaco plot

Brennan Williams
In reply to this post by bryce hendrix-2
On 18/05/2011 2:41 a.m., bryce hendrix wrote:
Brennan,

I think the attributes you're looking for are tick_label_position and tick_label_offset, and maybe ensure_labels_bounded. Tick label layout is one of those areas of Chaco that no one is very proud of. Hopefully with these attributes you can coerce what you're looking for.

Well I'm happy with the numeric labelling of the tick marks so I don't think that is what I need. It is the axis title positioning that is the problem.
Any ideas on how I can force the positioning of the title?
So, that said- we've had several discussions about plot axis lately. I'm of the opinion that we redo the whole thing. The process of attaching axis as underlays requires the user to know way too much about the Chaco internals. IMO you should be able to create a lightweight axis object and attach it to either the left or right of the plot and let Chaco worry about where and how to render it.

I think I agree although I don't have a great understanding of Chaco internals.

I find using "Plot" ok if I only have one x axis and one y axis. If I have more than one line or scatter plot to add to it then I use create_line_plot or create_scatter_plot and then .add that to the Plot.

Once you get to the point of wanting a second y axis then it becomes more complicated. As you state above I use PlotAxis and then attach it to the underaly of the Plot. If I want more than two y axes then as far as I can tell, I can't use Plot. I think I got multiple overlaid y axes plotted in the same location.

And quite often I want two x axes - a time axis on the top and a date axis on the bottom. I use a LabelAxis for this but again it can get quite messy.

Brennan

Bryce

On Mon, May 16, 2011 at 10:35 PM, Brennan Williams <[hidden email]> wrote:
I've got a bit closer to setting up multiple axes on both the left and the right hand sides of a plot - see attached screenshot.

Unlike the screenshot in my previous posting I now have the left and right axes correctly aligned with the plot.

Each of the axes is a PlotAxis while the line plots are created using create_line_plot and are added to an OverlayPlotContainer.

An HPlotContainer is then created to which is added (in order) the left axes, the OverlayPlotContainer and then the right axes....

plot_area=OverlayPlotContainer(bgcolor="transparent)
bigcontainer=HPlotContainer()
leftaxeslist=[]
rightaxeslist=[]

for item in plotitemlist:
    renderer=create_line_plot(....)
    plot_area.add(renderer)
    axis=PlotAxis(....)
    if left:
      leftaxislist.append(axis)
    else:
      rightaxislist.append(axis)   

for axis in leftaxislist:
    bigcontainer.add(axis)
bigcontainer.add(plot_area)
for axis in rightaxislist:
    bigcontainer.add(axis)


The remaining problem I have is the orientation and positioning of the axis titles on the rhs axes.
The axes are created using...

 yaxis=PlotAxis(
                    title=axistitle,
                    resizable='v',
                    mapper=renderer.y_mapper,
                    tick_label_formatter=lambda val: "%0.5g"%val,
                    orientation=ps.axisorientation,
                    axis_line_color=vcolour,
                    tick_color=vcolour,
                    tick_label_color=vcolour,
                    title_color=vcolour,
                    bgcolor="white",
                    border_visible=False)

where the orientation is either "left" or "right".

The left axes are ok, tick mark labels are to the left, axis title is offset a little bit more to the left and the text goes up vertically

With the right axes the tock mark labels are ok, i.e. they are to the right but the axis title is incorrectly positioned.

So I'm not sure how I can correctly set or override the positioning of the right axis title. "orientation" doesnt seem to be doing it.
I looked at the documentation for PlotAxis and the title attribute is defined as....

title = Trait('?', PlotLabel, Str, Unicode, label = 'Title')

which I don't think I'm interpreting correctly. If I set title to be a text string that is fine, I get that string plotted,
albeit in the wrong place so I thought I would try setting title to be a PlotLabel...

yaxis.title=PlotLabel('my title',alignment=45)

but that causes an error saying it has to be a Str or Unicode.

I tried wrapping it with Trait...

yaxis.title=Trait(PlotLabel('my title',alignment=45))

but got the same error.


Any ideas on what I need to do? Once I've got it working correctly I'll put together a "multiple_left_and_right_axes.py" 
example to go with stacked_axis.py
Regards Brennan

On 13/05/2011 11:58 a.m., Brennan Williams wrote:
I've been looking at Bryce's stacked_axis.py Chaco example to try and add additional axes to the left and right of my Chaco plots.
See attached for where I've got to so far.

I have a couple of issues that you may be able to help me with, probably to do with how I'm using containers.
I'm going to remove the borders around the outside of each axis as they are going through the axis titles. My left hand axes look ok with the tick labels on the lhs and the axis title to the left. On the righ hand axes however my ticl labels are ok (to the right) but my axis title is still to the left and the text is going up the screen rather than down.

As you can see I've got a left and right hand axis attached to my plot so you can see how the additional right hand axes should look.

My other main problem is how to get the axes to vertically line up with my plot. I have the 2 extra left axes in an HPlotContainer and the 2 extra right axes in a separate HPlotContainer. My actual line plots with the title above the plot, the top and bottom x xaxes and the left and right y axes are all in a "Plot".

So I have something like....
self.leftaxescontainer=HPlotContainer()
self.rightaxescontainer=HPlotContainer()
self.plot1=Plot(...)
....
code for creating the plots and axes and putting them in the containers above....
.....

self.gridcontainer=HPlotContainer()
self.gridcontainer.add(self.leftaxescontainer)
self.gridcontainer.add(self.plot1)
self.gridcontainer.add(self.rightaxescontainer)

and that gets me what you see in my screenshot. So it's not quite the same as the stacked_axis.py demo where the axes do line up. However that demo doesn't use Plot and it also doesn't have a title - I think those are the two issues causing my problem.

I'm thinking of stripping out my use of Plot and replacing it with create_line_plot and create_scatter_plot and adding everything into one container. Not sure how I'm going to handle adding a title to that as I'm not sure yet what Plot does under the hood with the title text.

Any pointers on which is the best way to go?

Thanks

Brennan

_______________________________________________ Enthought-Dev mailing list [hidden email] https://mail.enthought.com/mailman/listinfo/enthought-dev


_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev


_______________________________________________ Enthought-Dev mailing list [hidden email] https://mail.enthought.com/mailman/listinfo/enthought-dev


_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev
Reply | Threaded
Open this post in threaded view
|

Re: multiple or stacked axes in a Chaco plot

Brennan Williams
In reply to this post by Brennan Williams
On 18/05/2011 12:03 p.m., Brennan Williams wrote:
> On 18/05/2011 2:32 a.m., John Wiggins wrote:
>> Hello Brennan,
>>
>> What happens if you modify the stacked_axis.py example so that the
>> orientation is right instead of left? That's working as expected on my
>> machine. (synced to the HEAD of branch old-namespace)
Just to confirm, I modified stacked_axis.py (see attached st2.py) which
gave the resulting screenshot. This has the same problem that my code
has, i.e. rhs axes tick mark labelling is fine but the
positioning/orientation of the title labelling is not. BTW I'm still
under EPD 6.2-2 32-bit on Windows 7 - I should have mentioned that in my
first post. I'm going to installed EPD 7.0 on another PC and see what I get.

Brennan

> It's been an interative process to get to where I currently am.
> Initially I was trying to keep my existing use of  "Plot" and add in the
> extra axes but then I replaced Plot with OverlayPlotContainer as in the
> stacked_axis.py example but I had problems getting the axes to display -
> they were in the HPlotContainer as I checked the components in each
> container. Can't quite remember exactly what was going wrong, I may have
> had a "component=renderer" line in my PlotAxis creation.
>
> But anyway I got there in the end. My current problem is the
> location/orientation of the title of the right had side axes. Are you
> saying that you can run a modified stacked_axis.py with axes on the rhs
> where the title is positioned correctly? If so, could you post/attach
> that example so I can see what I'm doing wrong?
>> As for the title attribute, the version that I have looks like this:
>>       title = Trait('', Str, Unicode) #May want to add PlotLabel option
>> Where is the documentation that said it was Trait('?', PlotLabel, Str,
>> Unicode, label = 'Title')? That should really be updated.
>>
> http://code.enthought.com/projects/files/ets_api/enthought.chaco.plot_axis.PlotAxis.html
>
> I found that doing a google on "Chaco PlotAxis". It does say ETS 2.7.1
> at the top.
>
> I see you are probably looking at...
>
> http://code.enthought.com/projects/files/ETS32_API/enthought.chaco.axis.PlotAxis.html
>
> so I need to make sure I'm in the ETS32_API tree and not the ets_api one.
>
> Brennan
>
>> - John
>>
>> On Mon, May 16, 2011 at 10:35 PM, Brennan Williams
>> <[hidden email]>   wrote:
>>> I've got a bit closer to setting up multiple axes on both the left and the
>>> right hand sides of a plot - see attached screenshot.
>>>
>>> Unlike the screenshot in my previous posting I now have the left and right
>>> axes correctly aligned with the plot.
>>>
>>> Each of the axes is a PlotAxis while the line plots are created using
>>> create_line_plot and are added to an OverlayPlotContainer.
>>>
>>> An HPlotContainer is then created to which is added (in order) the left
>>> axes, the OverlayPlotContainer and then the right axes....
>>>
>>> plot_area=OverlayPlotContainer(bgcolor="transparent)
>>> bigcontainer=HPlotContainer()
>>> leftaxeslist=[]
>>> rightaxeslist=[]
>>>
>>> for item in plotitemlist:
>>>       renderer=create_line_plot(....)
>>>       plot_area.add(renderer)
>>>       axis=PlotAxis(....)
>>>       if left:
>>>         leftaxislist.append(axis)
>>>       else:
>>>         rightaxislist.append(axis)
>>>
>>> for axis in leftaxislist:
>>>       bigcontainer.add(axis)
>>> bigcontainer.add(plot_area)
>>> for axis in rightaxislist:
>>>       bigcontainer.add(axis)
>>>
>>>
>>> The remaining problem I have is the orientation and positioning of the axis
>>> titles on the rhs axes.
>>> The axes are created using...
>>>
>>>    yaxis=PlotAxis(
>>>                       title=axistitle,
>>>                       resizable='v',
>>>                       mapper=renderer.y_mapper,
>>>                       tick_label_formatter=lambda val: "%0.5g"%val,
>>>                       orientation=ps.axisorientation,
>>>                       axis_line_color=vcolour,
>>>                       tick_color=vcolour,
>>>                       tick_label_color=vcolour,
>>>                       title_color=vcolour,
>>>                       bgcolor="white",
>>>                       border_visible=False)
>>>
>>> where the orientation is either "left" or "right".
>>>
>>> The left axes are ok, tick mark labels are to the left, axis title is offset
>>> a little bit more to the left and the text goes up vertically
>>>
>>> With the right axes the tock mark labels are ok, i.e. they are to the right
>>> but the axis title is incorrectly positioned.
>>>
>>> So I'm not sure how I can correctly set or override the positioning of the
>>> right axis title. "orientation" doesnt seem to be doing it.
>>> I looked at the documentation for PlotAxis and the title attribute is
>>> defined as....
>>>
>>> title = Trait('?', PlotLabel, Str, Unicode, label = 'Title')
>>>
>>> which I don't think I'm interpreting correctly. If I set title to be a text
>>> string that is fine, I get that string plotted,
>>> albeit in the wrong place so I thought I would try setting title to be a
>>> PlotLabel...
>>>
>>> yaxis.title=PlotLabel('my title',alignment=45)
>>>
>>> but that causes an error saying it has to be a Str or Unicode.
>>>
>>> I tried wrapping it with Trait...
>>>
>>> yaxis.title=Trait(PlotLabel('my title',alignment=45))
>>>
>>> but got the same error.
>>>
>>>
>>> Any ideas on what I need to do? Once I've got it working correctly I'll put
>>> together a "multiple_left_and_right_axes.py"
>>> example to go with stacked_axis.py
>>>
>>> Regards
>>>
>>> Brennan
>>>
>>> On 13/05/2011 11:58 a.m., Brennan Williams wrote:
>>>
>>> I've been looking at Bryce's stacked_axis.py Chaco example to try and add
>>> additional axes to the left and right of my Chaco plots.
>>> See attached for where I've got to so far.
>>>
>>> I have a couple of issues that you may be able to help me with, probably to
>>> do with how I'm using containers.
>>> I'm going to remove the borders around the outside of each axis as they are
>>> going through the axis titles. My left hand axes look ok with the tick
>>> labels on the lhs and the axis title to the left. On the righ hand axes
>>> however my ticl labels are ok (to the right) but my axis title is still to
>>> the left and the text is going up the screen rather than down.
>>>
>>> As you can see I've got a left and right hand axis attached to my plot so
>>> you can see how the additional right hand axes should look.
>>>
>>> My other main problem is how to get the axes to vertically line up with my
>>> plot. I have the 2 extra left axes in an HPlotContainer and the 2 extra
>>> right axes in a separate HPlotContainer. My actual line plots with the title
>>> above the plot, the top and bottom x xaxes and the left and right y axes are
>>> all in a "Plot".
>>>
>>> So I have something like....
>>> self.leftaxescontainer=HPlotContainer()
>>> self.rightaxescontainer=HPlotContainer()
>>> self.plot1=Plot(...)
>>> ....
>>> code for creating the plots and axes and putting them in the containers
>>> above....
>>> .....
>>>
>>> self.gridcontainer=HPlotContainer()
>>> self.gridcontainer.add(self.leftaxescontainer)
>>> self.gridcontainer.add(self.plot1)
>>> self.gridcontainer.add(self.rightaxescontainer)
>>>
>>> and that gets me what you see in my screenshot. So it's not quite the same
>>> as the stacked_axis.py demo where the axes do line up. However that demo
>>> doesn't use Plot and it also doesn't have a title - I think those are the
>>> two issues causing my problem.
>>>
>>> I'm thinking of stripping out my use of Plot and replacing it with
>>> create_line_plot and create_scatter_plot and adding everything into one
>>> container. Not sure how I'm going to handle adding a title to that as I'm
>>> not sure yet what Plot does under the hood with the title text.
>>>
>>> Any pointers on which is the best way to go?
>>>
>>> Thanks
>>>
>>> Brennan
>>>
>>>
>>> _______________________________________________
>>> Enthought-Dev mailing list
>>> [hidden email]
>>> https://mail.enthought.com/mailman/listinfo/enthought-dev
>>>
>>>
>>> _______________________________________________
>>> Enthought-Dev mailing list
>>> [hidden email]
>>> https://mail.enthought.com/mailman/listinfo/enthought-dev
>>>
>>>
>> _______________________________________________
>> Enthought-Dev mailing list
>> [hidden email]
>> https://mail.enthought.com/mailman/listinfo/enthought-dev
>>
> _______________________________________________
> Enthought-Dev mailing list
> [hidden email]
> https://mail.enthought.com/mailman/listinfo/enthought-dev
>

_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev

st2.png (99K) Download Attachment
st2.py (5K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: multiple or stacked axes in a Chaco plot

bryce hendrix-2
On Tue, May 17, 2011 at 7:42 PM, Brennan Williams <[hidden email]> wrote:
On 18/05/2011 12:03 p.m., Brennan Williams wrote:
On 18/05/2011 2:32 a.m., John Wiggins wrote:
Hello Brennan,

What happens if you modify the stacked_axis.py example so that the
orientation is right instead of left? That's working as expected on my
machine. (synced to the HEAD of branch old-namespace)
Just to confirm, I modified stacked_axis.py (see attached st2.py) which gave the resulting screenshot. This has the same problem that my code has, i.e. rhs axes tick mark labelling is fine but the positioning/orientation of the title labelling is not. BTW I'm still under EPD 6.2-2 32-bit on Windows 7 - I should have mentioned that in my first post. I'm going to installed EPD 7.0 on another PC and see what I get.

Ah, I see. 

John, didn't you fix this lately for one of the geo plots using Scott's fix?

Bryce

_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev
Reply | Threaded
Open this post in threaded view
|

Re: multiple or stacked axes in a Chaco plot

Brennan Williams
On 18/05/2011 12:47 p.m., bryce hendrix wrote:
On Tue, May 17, 2011 at 7:42 PM, Brennan Williams <[hidden email]> wrote:
On 18/05/2011 12:03 p.m., Brennan Williams wrote:
On 18/05/2011 2:32 a.m., John Wiggins wrote:
Hello Brennan,

What happens if you modify the stacked_axis.py example so that the
orientation is right instead of left? That's working as expected on my
machine. (synced to the HEAD of branch old-namespace)
Just to confirm, I modified stacked_axis.py (see attached st2.py) which gave the resulting screenshot. This has the same problem that my code has, i.e. rhs axes tick mark labelling is fine but the positioning/orientation of the title labelling is not. BTW I'm still under EPD 6.2-2 32-bit on Windows 7 - I should have mentioned that in my first post. I'm going to installed EPD 7.0 on another PC and see what I get.

Ah, I see. 

I was taking another look at the Chaco examples and attached is a modified multiaxis_using_Plot.py together with screenshot.

Two points to note...

(1) The title of the rhs axis is "right" and as oyu can see it is plotted to the right of the tick mark labels and is oriented down rather than up.

(2) I also tried out PlotAxis.title_spacing to see if I could move the axis title spatially left or right but actually it only moves the title up or down. In the screenshot the positioning of both the "bottom x axis" title and the "right" title are the result of a title_spacing=0. For me, "bottom x axis" is displayed correctly, i.e. just below the x-axis line but I was expecting "right" to vertically stay in the middle of the rhs axis but be moved left to be almost touching the vertical axis line. Instead a title_spacing of 0 meant it has been moved vertically down to the bottom of the axis.

So for me title_spacing doesn't work correctly for a vertical axis.

All of these axes are , I assume, a PlotAxis so I'm going to try and dig down through how these are plotted/rendered to work out why I can't get my rhs axis title displaying properly.

Brennan
 
John, didn't you fix this lately for one of the geo plots using Scott's fix?

Bryce
_______________________________________________ Enthought-Dev mailing list [hidden email] https://mail.enthought.com/mailman/listinfo/enthought-dev


_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev

multiaxis_using_Plot2.py (3K) Download Attachment
multiaxis_using_Plot.png (98K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: multiple or stacked axes in a Chaco plot

Brennan Williams
OK I think I've found where the problem with the positioning of the title on a right hand axis is occurring....

I've looked at (on my machine).... c:\python26\Lib\site-packages\enthought\chaco\axis.py

In _draw_component there is the following....

        if not self._cache_valid:
            if component is not None:
                self._calculate_geometry(component)
            else:
                self._old_calculate_geometry()
            self._compute_tick_positions(gc, component)
            self._compute_labels(gc)

Now if I create a PlotAxis that has a component, e.g. when I attach it to the underlay of a Plot, then the above calls _calculate_geometry
If, instead, I create a PlotAxis that doesn't have a component, e.g. when I .add it to an HPlotContainer then the above calls _old_calculate_geometry

 In _calculate_geometry, if orientation is left then title_angle=90 and if orientation is right then title_angle=270

In _old_calculate_geometry if orientation is left or right then title_angle=90

And it is title_angle that is used to work out the horizontal and vertical positioning of the axis title.

So basically I think it just needs a small fix to _old_calculate_geometry....

            if self.orientation == 'left':
                self.title_angle = 90.0
                ........
            else: #self.orientation == 'right'
                self.title_angle = 270.0
                ........

For me, that then produces the attached plot which as you can see now has the right hand axes titles correctly positioned.


On the title_spacing issue, _draw_title in axis.py is where this is used. Setting a value for title_spacing only affects the vertical offset v_offset and has not effect on the horizontal offset h_offset.

Perhaps there should either be both a title_vspacing and title_hspacing attribute or else title_spacing should affect h_offset when the title_angle is either 90 or 270. There is code in there for when title_angle is something other than 0,90 or 270 so perhaps it should be made more generic and have both title_vspacing and title_hspacing.

Brennan

On 18/05/2011 2:08 p.m., Brennan Williams wrote:
On 18/05/2011 12:47 p.m., bryce hendrix wrote:
On Tue, May 17, 2011 at 7:42 PM, Brennan Williams <[hidden email]> wrote:
On 18/05/2011 12:03 p.m., Brennan Williams wrote:
On 18/05/2011 2:32 a.m., John Wiggins wrote:
Hello Brennan,

What happens if you modify the stacked_axis.py example so that the
orientation is right instead of left? That's working as expected on my
machine. (synced to the HEAD of branch old-namespace)
Just to confirm, I modified stacked_axis.py (see attached st2.py) which gave the resulting screenshot. This has the same problem that my code has, i.e. rhs axes tick mark labelling is fine but the positioning/orientation of the title labelling is not. BTW I'm still under EPD 6.2-2 32-bit on Windows 7 - I should have mentioned that in my first post. I'm going to installed EPD 7.0 on another PC and see what I get.

Ah, I see. 

I was taking another look at the Chaco examples and attached is a modified multiaxis_using_Plot.py together with screenshot.

Two points to note...

(1) The title of the rhs axis is "right" and as oyu can see it is plotted to the right of the tick mark labels and is oriented down rather than up.

(2) I also tried out PlotAxis.title_spacing to see if I could move the axis title spatially left or right but actually it only moves the title up or down. In the screenshot the positioning of both the "bottom x axis" title and the "right" title are the result of a title_spacing=0. For me, "bottom x axis" is displayed correctly, i.e. just below the x-axis line but I was expecting "right" to vertically stay in the middle of the rhs axis but be moved left to be almost touching the vertical axis line. Instead a title_spacing of 0 meant it has been moved vertically down to the bottom of the axis.

So for me title_spacing doesn't work correctly for a vertical axis.

All of these axes are , I assume, a PlotAxis so I'm going to try and dig down through how these are plotted/rendered to work out why I can't get my rhs axis title displaying properly.

Brennan
 
John, didn't you fix this lately for one of the geo plots using Scott's fix?

Bryce
_______________________________________________ Enthought-Dev mailing list [hidden email] https://mail.enthought.com/mailman/listinfo/enthought-dev

_______________________________________________ Enthought-Dev mailing list [hidden email] https://mail.enthought.com/mailman/listinfo/enthought-dev


_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev

stackedaxisfixed.png (103K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: multiple or stacked axes in a Chaco plot

John Wiggins
I rewrote many parts of PlotAxis right before EPD 7.0 came out, so you
should definitely upgrade your ETS install at the very least. Let us
know if you're still seeing problems with the newer code.

- John

On Tue, May 17, 2011 at 9:47 PM, Brennan Williams
<[hidden email]> wrote:

> OK I think I've found where the problem with the positioning of the title on
> a right hand axis is occurring....
>
> I've looked at (on my machine)....
> c:\python26\Lib\site-packages\enthought\chaco\axis.py
>
> In _draw_component there is the following....
>
>         if not self._cache_valid:
>             if component is not None:
>                 self._calculate_geometry(component)
>             else:
>                 self._old_calculate_geometry()
>             self._compute_tick_positions(gc, component)
>             self._compute_labels(gc)
>
> Now if I create a PlotAxis that has a component, e.g. when I attach it to
> the underlay of a Plot, then the above calls _calculate_geometry
> If, instead, I create a PlotAxis that doesn't have a component, e.g. when I
> .add it to an HPlotContainer then the above calls _old_calculate_geometry
>
>  In _calculate_geometry, if orientation is left then title_angle=90 and if
> orientation is right then title_angle=270
>
> In _old_calculate_geometry if orientation is left or right then
> title_angle=90
>
> And it is title_angle that is used to work out the horizontal and vertical
> positioning of the axis title.
>
> So basically I think it just needs a small fix to
> _old_calculate_geometry....
>
>             if self.orientation == 'left':
>                 self.title_angle = 90.0
>                 ........
>             else: #self.orientation == 'right'
>                 self.title_angle = 270.0
>                 ........
>
> For me, that then produces the attached plot which as you can see now has
> the right hand axes titles correctly positioned.
>
>
> On the title_spacing issue, _draw_title in axis.py is where this is used.
> Setting a value for title_spacing only affects the vertical offset v_offset
> and has not effect on the horizontal offset h_offset.
>
> Perhaps there should either be both a title_vspacing and title_hspacing
> attribute or else title_spacing should affect h_offset when the title_angle
> is either 90 or 270. There is code in there for when title_angle is
> something other than 0,90 or 270 so perhaps it should be made more generic
> and have both title_vspacing and title_hspacing.
>
> Brennan
>
> On 18/05/2011 2:08 p.m., Brennan Williams wrote:
>
> On 18/05/2011 12:47 p.m., bryce hendrix wrote:
>
> On Tue, May 17, 2011 at 7:42 PM, Brennan Williams
> <[hidden email]> wrote:
>>
>> On 18/05/2011 12:03 p.m., Brennan Williams wrote:
>>>
>>> On 18/05/2011 2:32 a.m., John Wiggins wrote:
>>>>
>>>> Hello Brennan,
>>>>
>>>> What happens if you modify the stacked_axis.py example so that the
>>>> orientation is right instead of left? That's working as expected on my
>>>> machine. (synced to the HEAD of branch old-namespace)
>>
>> Just to confirm, I modified stacked_axis.py (see attached st2.py) which
>> gave the resulting screenshot. This has the same problem that my code has,
>> i.e. rhs axes tick mark labelling is fine but the positioning/orientation of
>> the title labelling is not. BTW I'm still under EPD 6.2-2 32-bit on Windows
>> 7 - I should have mentioned that in my first post. I'm going to installed
>> EPD 7.0 on another PC and see what I get.
>
> Ah, I see.
>
> I was taking another look at the Chaco examples and attached is a modified
> multiaxis_using_Plot.py together with screenshot.
>
> Two points to note...
>
> (1) The title of the rhs axis is "right" and as oyu can see it is plotted to
> the right of the tick mark labels and is oriented down rather than up.
>
> (2) I also tried out PlotAxis.title_spacing to see if I could move the axis
> title spatially left or right but actually it only moves the title up or
> down. In the screenshot the positioning of both the "bottom x axis" title
> and the "right" title are the result of a title_spacing=0. For me, "bottom x
> axis" is displayed correctly, i.e. just below the x-axis line but I was
> expecting "right" to vertically stay in the middle of the rhs axis but be
> moved left to be almost touching the vertical axis line. Instead a
> title_spacing of 0 meant it has been moved vertically down to the bottom of
> the axis.
>
> So for me title_spacing doesn't work correctly for a vertical axis.
>
> All of these axes are , I assume, a PlotAxis so I'm going to try and dig
> down through how these are plotted/rendered to work out why I can't get my
> rhs axis title displaying properly.
>
> Brennan
>
>
> John, didn't you fix this lately for one of the geo plots using Scott's fix?
> Bryce
>
> _______________________________________________
> Enthought-Dev mailing list
> [hidden email]
> https://mail.enthought.com/mailman/listinfo/enthought-dev
>
>
> _______________________________________________
> Enthought-Dev mailing list
> [hidden email]
> https://mail.enthought.com/mailman/listinfo/enthought-dev
>
>
> _______________________________________________
> Enthought-Dev mailing list
> [hidden email]
> https://mail.enthought.com/mailman/listinfo/enthought-dev
>
>
_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev