Code Monkey home page Code Monkey logo

Comments (4)

GjjvdBurg avatar GjjvdBurg commented on July 26, 2024 1

The fontsize option is used in the \documentclass command in the latex document. This supports 10pt, 11pt, and 12pt. Use this to set the font size of the axis labels. To change the font of the text labels, you can use the standard latex commands (for instance \Large). Here's an example with timeline_kit_1.py:

diff --git a/examples/timeline_kit_1.py b/examples/timeline_kit_1.py
index 8ebf35f..ec760ca 100644
--- a/examples/timeline_kit_1.py
+++ b/examples/timeline_kit_1.py
@@ -51,7 +51,7 @@ def main():
         "dotColor": "#000000",
         "labelBgColor": "#000000",
         "linkColor": "#000000",
-        "textFn": lambda x: str(x["time"].year) + " - " + x["text"],
+        "textFn": lambda x: "{\Large %s -- %s}" % (x["time"].year, x["text"]),
         "labelPadding": {"left": 2, "right": 0, "top": 0, "bottom": 0},
         "labella": {
             "nodeHeight": 12,

from labella.py.

GjjvdBurg avatar GjjvdBurg commented on July 26, 2024 1

The nodeHeight seems to be related to the distance between rows of labels (it's been a while since I wrote this package). You can however hack some more padding into the Latex labels using the \rule command, here's an example:

diff --git a/examples/timeline_kit_1.py b/examples/timeline_kit_1.py
index ba1ccaf..1b787d9 100644
--- a/examples/timeline_kit_1.py
+++ b/examples/timeline_kit_1.py
@@ -44,6 +44,9 @@ def main():
         },
     ]
 
+    textFn = (
+        lambda d: f"\\rule[-17pt]{{0pt}}{{40pt}}{d['time'].year} -- {d['text']}"
+    )
     options = {
         "margin": {"left": 40.5, "right": 20, "top": 20, "bottom": 20},
         "initialWidth": 400,
@@ -52,7 +55,7 @@ def main():
         "dotColor": "#000000",
         "labelBgColor": "#000000",
         "linkColor": "#000000",
-        "textFn": lambda x: str(x["time"].year) + " - " + x["text"],
+        "textFn": textFn,
         "labelPadding": {"left": 2, "right": 0, "top": 0, "bottom": 0},
         "labella": {
             "nodeHeight": 12,

Hope this helps, let's leave this issue open as a reminder to look into making this easier.

from labella.py.

SeaDude avatar SeaDude commented on July 26, 2024

That works well, thank you.
Heres are some references for those of us new to LaTeX standard font sizes: https://latex-tutorial.com/changing-font-size/

What do you think about the nodeHeight? I see that they proportionally grow as the text size increases. Is it possible to make the timeline events have more real estate?

from labella.py.

SeaDude avatar SeaDude commented on July 26, 2024

I'll try that. Take care!

from labella.py.

Related Issues (15)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.