Re: Text annotations not appearing when floats are used in XY plot with modified axis labels

From: Carmen St. Jean <carmen.stjean_at_nyahnyahspammersnyahnyah>
Date: Fri Jun 29 2012 - 13:09:16 MDT

Hi Mary,

It's alright. I am trying to add a bunch of text above and below,
with only one plot per page, so using Ngl.text_ndc instead of Ngl.text
and Ngl.annotation is probably a good suggestion.

I suppose though I was wondering if there is a better way to add
properly scaled right y-axis labels in another unit and customize
x-axis labels to show another unit. I don't know if these axis label
modifications are problematic, therefore preventing other text from
being added to the plot. It kind of seems like it because when I turn
off these label modifications, then my text above and below the plot
works.

Thanks for your suggestion though, I'll experiment with that and see
how it works.

Carmen

On Fri, Jun 29, 2012 at 3:02 PM, Mary Haley <haley@ucar.edu> wrote:
> Hi Carmen,
>
> I completely missed this question, sorry. My mailer was not showing me the "new email" icon in my folders.
>
> To answer about a better way of doing it: it depends on what exactly you are trying to do.
>
> Are you trying to add a bunch of titles to the top and bottom of your plot, with several lines in each?
>
> If you don't need to create several of these plots on one page, then maybe the better thing to
> do is use Ngl.text_ndc, and don't even bother with Ngl.text and Ngl.add_annotation.  Just
> use NDC (0 to 1) values to position the text.
>
> See the attached modified script I only did the top subtitles, and did this in a hurry, so
> the titles are probably too high.
>
> --Mary
>
>
>
> On Jun 20, 2012, at 1:40 PM, Carmen St. Jean wrote:
>
>> Hello Mary,
>>
>> Thanks for looking into it and also for opening a ticket!  I hope we
>> can figure this out.  I have been able to get Oleksandr's solution to
>> work only in the simple version of my script, so I'm glad you wrote to
>> me.
>>
>> Your solution works in the complicated version of my script, but
>> depending on the values of the x-axis.  For example, in one of my
>> plots, x ranges from 61 to 63 degrees Fahrenheit, so the data gets
>> squished to the right side of the plot since the x-axis is ranging
>> from 0 to 63.  I tried to set res.trXMinF to the minimum temperature
>> instead, but this made the text annotations disappear.
>>
>> As for my x-axis and y-axis relabeling, is there a better way of going
>> about that?  The way I'm doing it now seems to be part of the problem
>> here; this was the only approach I could think of with my limited
>> PyNGL experience.
>>
>> Thank you,
>>
>> Carmen
>>
>> On Wed, Jun 20, 2012 at 2:43 PM, Mary Haley <haley@ucar.edu> wrote:
>>> Hi Carmen,
>>>
>>> Thanks for providing a set of scripts that illustrate the problem.
>>>
>>> This has me completely puzzled.
>>>
>>> I thought it had something to do with the range of your Y axis. Through some trial and error, I found that adding:
>>>
>>> res.trXMinF = 0
>>>
>>> to the xy_plot_floats_with_labels.py code causes the labels to show up.  This really makes no sense, because "trXMinF" is actually getting set to 0.0 internally.
>>>
>>> I'll look into this some more, but hopefully the work-arounds are acceptable for you at the moment. The trouble ticket on this is PyNGL-71.
>>>
>>> --Mary
>>>
>>> On Jun 20, 2012, at 10:49 AM, Carmen St. Jean wrote:
>>>
>>>> Hello again Oleksandr,
>>>>
>>>> You're right!  (It looks like I got your code mixed up with mine of
>>>> the same name; I thought I overwrote my old one but hadn't.  Sorry
>>>> about that.)  It works indeed...  Thanks so much!
>>>>
>>>> Carmen
>>>>
>>>> On Wed, Jun 20, 2012 at 12:43 PM, Oleksandr Huziy <guziy.sasha@gmail.com> wrote:
>>>>> They are also floats in the script I have sent you. But the labels are
>>>>> showing. I was guessing that with x=y=0, you somehow got your captions
>>>>> outside the figure.
>>>>>
>>>>> Cheers
>>>>> --
>>>>> Oleksandr
>>>>>
>>>>>
>>>>> 2012/6/20 Carmen St. Jean <carmen.stjean@noaa.gov>
>>>>>>
>>>>>> Hi Oleksandr,
>>>>>>
>>>>>> I'm sorry; I really wasn't very clear about which float and integer
>>>>>> values I was referring to.  The x and y values I meant are the x and y
>>>>>> inputs for the Ngl.xy() function, not any positioning values for calls
>>>>>> to the Ngl.text() function.  Please see the plotTemps,
>>>>>> plotElevsMeters, and plotElevsFeet variables in my code.
>>>>>>
>>>>>> Thanks,
>>>>>>
>>>>>> Carmen
>>>>>>
>>>>>> On Wed, Jun 20, 2012 at 12:30 PM, Oleksandr Huziy <guziy.sasha@gmail.com>
>>>>>> wrote:
>>>>>>> Hi,
>>>>>>>
>>>>>>> I am just a beginner with pyngl, but when I put x=0.1 and y=-0.1
>>>>>>> in Ngl.text it kind of works. See the attached script.
>>>>>>>
>>>>>>> Cheers
>>>>>>> --
>>>>>>> Oleksandr (Sasha) Huziy
>>>>>>> Phd student, UQAM
>>>>>>>
>>>>>>> 2012/6/20 Carmen St. Jean <carmen.stjean@noaa.gov>
>>>>>>>>
>>>>>>>> Hello,
>>>>>>>>
>>>>>>>> I've run into the most puzzling problem with my code under extremely
>>>>>>>> specific circumstances.
>>>>>>>>
>>>>>>>> I have an xy plot where I have modified the x-axis and y-axis labels
>>>>>>>> in order to show additional units (i.e., degrees F in addition to
>>>>>>>> degrees C and feet in addition to meters).  Then I am attempting to
>>>>>>>> place three lines of text above my plot and three lines of text below
>>>>>>>> my plot by using text annotations.
>>>>>>>>
>>>>>>>> The problem is that the text above and below the plot only appear when
>>>>>>>> I am using integer values instead of floats for x and y.  Or if I use
>>>>>>>> floats while I don't bother modifying my x-axis and y-axis labels,
>>>>>>>> then the text does appear.  But if I modify the axis labels and use
>>>>>>>> floats, then the text annotations simply do not appear.  It is
>>>>>>>> surprising that this is happening because I was able to modify the
>>>>>>>> labels x-axis and y-axis of a contour plot and successfully add text
>>>>>>>> above and below the plot.  The input I gave the contour function was
>>>>>>>> all float values.
>>>>>>>>
>>>>>>>> So this leaves me unsure of where the underlying problem is...  Is my
>>>>>>>> approach to modifying my labels is problematic so that it is somehow
>>>>>>>> affecting the text annotations down the road (though only when I am
>>>>>>>> using floats for x and y)?  Is there something I have overlooked here?
>>>>>>>>
>>>>>>>> Thanks,
>>>>>>>>
>>>>>>>> Carmen
>>>>>>>>
>>>>>>>> _______________________________________________
>>>>>>>> pyngl-talk mailing list
>>>>>>>> List instructions, subscriber options, unsubscribe:
>>>>>>>> http://mailman.ucar.edu/mailman/listinfo/pyngl-talk
>>>>>>>>
>>>>>>>
>>>>>
>>>>>
>>>> _______________________________________________
>>>> pyngl-talk mailing list
>>>> List instructions, subscriber options, unsubscribe:
>>>> http://mailman.ucar.edu/mailman/listinfo/pyngl-talk
>>>
>> <cbofs_profile_temp_t0-tempfix.png>
>
>
Received on Fri Jun 29 13:09:20 2012

This archive was generated by hypermail 2.1.8 : Thu Sep 13 2012 - 15:38:36 MDT