<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=us-ascii"><meta name=Generator content="Microsoft Word 12 (filtered medium)"><base href="x-msg://6/"><!--[if !mso]><style>v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style><![endif]--><style><!--
/* Font Definitions */
@font-face
        {font-family:Wingdings;
        panose-1:5 0 0 0 0 0 0 0 0 0;}
@font-face
        {font-family:Wingdings;
        panose-1:5 0 0 0 0 0 0 0 0 0;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
        {mso-style-priority:34;
        margin-top:0cm;
        margin-right:0cm;
        margin-bottom:0cm;
        margin-left:36.0pt;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
span.apple-converted-space
        {mso-style-name:apple-converted-space;}
span.apple-style-span
        {mso-style-name:apple-style-span;}
span.E-MailFormatvorlage19
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:70.85pt 70.85pt 2.0cm 70.85pt;}
div.WordSection1
        {page:WordSection1;}
/* List Definitions */
@list l0
        {mso-list-id:1137722746;
        mso-list-type:hybrid;
        mso-list-template-ids:-1395878956 67567631 67567641 67567643 67567631 67567641 67567643 67567631 67567641 67567643;}
@list l0:level1
        {mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;}
@list l1
        {mso-list-id:1338535539;
        mso-list-type:hybrid;
        mso-list-template-ids:-1276762544 67567631 67567641 67567643 67567631 67567641 67567643 67567631 67567641 67567643;}
@list l1:level1
        {mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;}
@list l2
        {mso-list-id:1423378396;
        mso-list-type:hybrid;
        mso-list-template-ids:1708933214 610027638 67567619 67567621 67567617 67567619 67567621 67567617 67567619 67567621;}
@list l2:level1
        {mso-level-start-at:0;
        mso-level-number-format:bullet;
        mso-level-text:-;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        margin-left:53.25pt;
        text-indent:-18.0pt;
        font-family:"Calibri","sans-serif";
        mso-fareast-font-family:Calibri;
        mso-bidi-font-family:"Times New Roman";}
ol
        {margin-bottom:0cm;}
ul
        {margin-bottom:0cm;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=DE link=blue vlink=purple style='word-wrap: break-word;-webkit-nbsp-mode: space;-webkit-line-break: after-white-space'><div class=WordSection1><p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Hi Eric,<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>thanks for pointing me to vtkScalarsToColorsItem. This looks like a much more natural solution<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>than stitching everything together, as I did. I tried it and it works – thanks to Marcus’s last addition<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>to the vtkChartXY (vtkChartsXY::SetAutoSize I am even able to control the size of the chart for e.g.<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>reserving some space for a separate colorbar. And in this case the axes titles are placed correctly.<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>I do have however one problem remaining. Obviously the chart takes some space for its axes labels,<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>ticks and titles, so the displayed image actually takes less space than I assign to the whole chart via SetSize(). <o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Further, the space for the image could change in dependence of the axes labels, so the mapping from <o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>pixel coordinates to plot coordinates is not always the same, but has offsets depending on <o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>e.g. the label font size, length of number notation etc. <o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>But I would like to know (and control) the exact position of the displayed image in pixels:<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>First it makes data analysis using the rubber band interactor easier, since as far as I understand I get the<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>coordinates of the drawn rectangles in pixels coordinates, but not in plot coordinates (as I understand,<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>this can not be different, as the interactor is tied to the render window, not to the chart).<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Second (less important) in my application it just looks better if the position of the axes does change<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>from shot to shot (arguably this is a matter personal preferences…)<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>So is there a way to find out the space for the axes labels/ticks/titles for a given chart ? I tried to read out<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>the “Point1” of the axes, but unfortunately this seems to be given in local coordinates and not in <o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>respect to the overall scene. Methods like MapTo/FromParent/Scene sound like they should do the <o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>trick (the doc is not exactly extensive on those…), but they did not return me anything usable. Also I tried to find<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>the place where this is calculated in the source, but failed miserably. If you (or anybody else) could give<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>me some hints on this, that would be really great.<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Daniel<o:p></o:p></span></p><p class=MsoListParagraph style='margin-left:0cm'><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><div><div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm'><p class=MsoNormal><b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>Von:</span></b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'> Eric E. Monson [mailto:emonson@cs.duke.edu] <br><b>Gesendet:</b> Dienstag, 7. Dezember 2010 19:06<br><b>An:</b> Frese Daniel Dr.<br><b>Cc:</b> Marcus D. Hanwell; vtkusers@vtk.org<br><b>Betreff:</b> Re: AW: AW: [vtkusers] Positioning titles within vtkAxis<o:p></o:p></span></p></div></div><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Hey Daniel,<o:p></o:p></p><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>There seems to be something wrong with the painting for vtkAxis when used by itself in a scene. I'm not sure why we don't see this behavior when these axes are used within the charts. Hopefully Marcus will be able to take a look. You can see the problem even in the attached simple Python script.<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>One thing I noticed that maybe Marcus can comment on: Things like vtkChartXY do an Update on themselves before Paint. If in this script you don't call Update explicitly on the axis objects they paint the axis line and title, but not the ticks and their labels. Maybe it would be good to add and Update call at the beginning of vtkAxis::Paint?<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>Daniel, something you might want to consider instead of the method you're using now is a trick others are using for vtkScalarsToColorsItem and its subclasses: they make a subclass of vtkPlot which has a vtkImageData as a private Texture variable, and then paints the texture within the plot's bounds. This way they can instantiate a vtkChartXY and use AddPlot() to add what is basically an image painter, and then vtkChartXY takes care of the axes internally. Just an idea that I've seen the developers using.<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>Anyway, hopefully Marcus or someone else will be able to take a look at this sometime soon, but I know he's very busy right now.<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>Talk to you later,<o:p></o:p></p></div><div><p class=MsoNormal>-Eric<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal># =======<o:p></o:p></p></div><div><div><p class=MsoNormal>import vtk<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>view = vtk.vtkContextView()<o:p></o:p></p></div><div><p class=MsoNormal>view.GetRenderWindow().SetSize(400, 300)<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>axis1 = vtk.vtkAxis()<o:p></o:p></p></div><div><p class=MsoNormal>axis1.SetPoint1(75,75)<o:p></o:p></p></div><div><p class=MsoNormal>axis1.SetPoint2(75,225)<o:p></o:p></p></div><div><p class=MsoNormal>axis1.SetPosition(vtk.vtkAxis.LEFT)<o:p></o:p></p></div><div><p class=MsoNormal>axis1.SetTitle('YAxis')<o:p></o:p></p></div><div><p class=MsoNormal>axis1.Update()<o:p></o:p></p></div><div><p class=MsoNormal>view.GetScene().AddItem(axis1)<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>axis2 = vtk.vtkAxis()<o:p></o:p></p></div><div><p class=MsoNormal>axis2.SetPoint1(75,75)<o:p></o:p></p></div><div><p class=MsoNormal>axis2.SetPoint2(325,75)<o:p></o:p></p></div><div><p class=MsoNormal>axis2.SetPosition(vtk.vtkAxis.BOTTOM)<o:p></o:p></p></div><div><p class=MsoNormal>axis2.SetTitle('XAxis')<o:p></o:p></p></div><div><p class=MsoNormal>axis2.Update()<o:p></o:p></p></div><div><p class=MsoNormal>view.GetScene().AddItem(axis2)<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>view.Render()<o:p></o:p></p></div><div><p class=MsoNormal>view.GetInteractor().Start()<o:p></o:p></p></div><div><div><p class=MsoNormal># =======<o:p></o:p></p></div></div><div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal><img width=480 height=402 id=bc273b7a-daab-4d00-88a0-5cae2d2232c7 src="cid:image001.png@01CB96CB.2DB6BFF0"><o:p></o:p></p></div></div></div></div></body></html>