Dani, great to hear that you're fine with it.

And just for the audience: There is at least one useful case for boxed graph 
keys, though, namely when you have grid lines. You can use 
"keyattrs=[deco.stroked(), deco.filled([color.grey.white])]" to have a boxed, 
white graph key. I don't remember whether we show that in one of our examples.

Am 18.05.2015 um 20:51 schrieb Mico Filós <[email protected]>:

> Thanks again André. That will certainly do it, I was not looking for
> anything superfancy.
> 
> As for the boxed graph keys, and this is a very subjective view, I
> find them unnecessary and ugly. I am already happy  with your
> suggestion.
> 
> All the best,
> Dani
> 
> On Mon, May 18, 2015 at 11:52 AM, André Wobst
> <[email protected]> wrote:
>> Hi Dani,
>> 
>> hmm, in order to still use the PyX graph key functionality you could fake 
>> the distance by moving the text around. You need to know, that PyX uses the 
>> box size returned by TeX on the TeX level, not from the output. (The idea 
>> behind it is, that you PyX knows the dimensions of the text without reading 
>> the dvi output from TeX already, but only from interacting with TeX itself. 
>> And this gives you, intentionally, additional options for modifications.) 
>> PyX will align the text as it was, when PyX doesn't know about the new 
>> vertical dimension of the text. While you can surely do it in TeX itself, 
>> such a modification is easily done in LaTeX using \raisebox. Here is a 
>> slight modification of the code I already suggested. You could make the 
>> vertical shift (i.e. additional distance) to be a parameter, if needed. I 
>> just used a fix value of 10 pt, to make the effect visible clearly.
>> 
>> from pyx import *
>> 
>> text.set(cls=text.LatexRunner)
>> 
>> class DummyPlotItem:
>> 
>>   def __init__(self, title):
>>       self.title = "\\raisebox{10pt}[0pt][0pt]{%s}" % title
>> 
>>   def key_pt(self, c, x_pt, y_pt, width_pt, height_pt):
>>       pass
>> 
>> class TitleKey(graph.key.key):
>> 
>>   def __init__(self, title, **kwargs):
>>       self.title = title
>>       super().__init__(**kwargs)
>> 
>>   def paint(self, plotitems):
>>       return super().paint([DummyPlotItem(self.title)] + plotitems)
>> 
>> 
>> g = graph.graphxy(width=8,
>>                 x=graph.axis.linear(min=0, max=2),
>>                 y=graph.axis.linear(min=0, max=2),
>>                 key=TitleKey("$y$", pos="br", dist=0.1))
>> g.plot([graph.data.function("x(y)=y**4", title=r"$x^{1/4}$"),
>>       graph.data.function("x(y)=y**2", title=r"$x^{1/2}$"),
>>       graph.data.function("x(y)=y", title=r"$x$"),
>>       graph.data.function("y(x)=x**2", title=r"$x^2$"),
>>       graph.data.function("y(x)=x**4", title=r"$x^4$")],
>>      [graph.style.line([color.gradient.Rainbow])])
>> g.writePDFfile()
>> 
>> When aligning the graph key at the top, the shift is not taken into account, 
>> but you can modify the alignment parameters by passing proper values to the 
>> graph key instance. A border around the graph key becomes more difficult to 
>> fix. At a certain point it will probably be better to implement a proper 
>> titlegraphkey or so, but maybe the suggested solution does it for you 
>> already (when you don't need a border).
>> 
>> Best,
>> 
>> 
>> André
>> 
>> Am 17.05.2015 um 12:33 schrieb Mico Filós <[email protected]>:
>> 
>>> Sorry to bother you again, guys. I've just realized I would need some
>>> additional vertical space between the header and the rest of standard
>>> keyitems.
>>> 
>>> I have tried to add a strut (a vertical rule of a given height) in the
>>> header, but then the vertical space the between all keyitems is enlarged
>>> evenly, which is not what I wanted. I actually need the header to stand
>>> out by separating it slightly from the rest. Can you suggest me a hack
>>> to fix this?
>>> 
>>> Thanks a lot again,
>>> 
>>> Dani
>> 
>> --
>> by  _ _      _    Dr. André Wobst, Amselweg 22, 85716 Unterschleißheim
>>   / \ \    / )   [email protected], http://www.wobsta.de/
>>  / _ \ \/\/ /    PyX - High quality PostScript and PDF figures
>> (_/ \_)_/\_/     with Python & TeX: visit http://pyx.sourceforge.net/
>> 

-- 
by  _ _      _    Dr. André Wobst, Amselweg 22, 85716 Unterschleißheim
   / \ \    / )   [email protected], http://www.wobsta.de/
  / _ \ \/\/ /    PyX - High quality PostScript and PDF figures
 (_/ \_)_/\_/     with Python & TeX: visit http://pyx.sourceforge.net/

Attachment: smime.p7s
Description: S/MIME cryptographic signature

------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud 
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
PyX-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/pyx-user

Reply via email to