pyx-project / pyx

Repository of PyX, a Python package for the creation of PostScript, PDF, and SVG files.
https://pyx-project.org/
GNU General Public License v2.0
109 stars 18 forks source link

Add guideline for TikZ users #53

Open user202729 opened 6 months ago

user202729 commented 6 months ago

I think this could be useful, as a sizable number of TeX users are familiar with TikZ.

user202729 commented 6 months ago

Looking at it:

Did I miss something? (It sounds like a good idea to provide method to convert bbox to box.rect instance, although rect() method is already used)

Actually, I think there's no disadvantage in making bbox subclass from box.rect? (But will break backwards compatibility because center method etc.)

wobsta commented 6 months ago

I really like and appreciate your documentation efforts.

I am not quite sure whether we should have it as part of the one and single manual, though. Still, we might just merge and maybe split it later on. Jörg, would this be fine with you?

Regarding your request with scaling content: You can insert a canvas (sc) into another canvas (c) while applying transformations to it: c.insert(sc, [trafo.scale(2)]).

I consider the box module and code quite incomplete. It is fine to propose some extensions. For example, we could add .box() methods everywhere. In some sense they could be the official way to work, while bbox'es really should be internal.

user202729 commented 6 months ago

No, I already included it there. Just that that also scales the line width, which is the equivalent of TikZ' transform canvas and hardly what the user wants.

joerg-lehmann commented 6 months ago

wobsta wrote:

I am not quite sure whether we should have it as part of the one and single manual, though. Still, we might just merge and maybe split it later on. Jörg, would this be fine with you?

I am also a bit torn - which is why I brought you in the discussion. But for me, merging now and maybe splitting it later would be fine. The documentation per se is useful.

user202729 wrote:

No, I already included it there. Just that that also scales the line width, which is the equivalent of TikZ' transform canvas and hardly what the user wants.

Globally, what you want can be achieved by using unit.set(uscale=2). This scales all "user" lengths by a factor of 2 while leaving both the pre-defined linewidths and TeX sizes invariant. See the documentation of the unit module.