this-month-in-org/2021-04-30-export-plot.org
Timothy 787b24749c
DRAFT update (52 files changed)
Last source commit: 7958caa
Local time: 2024-09-08 15:20:47 (UTC+0800)
2024-09-08 15:20:47 +08:00

146 lines
7.1 KiB
Org Mode

# Created 2024-09-08 Sun 15:20
#+title: April 2021
#+date: 2021-04-30
#+author: TEC
#+subtitle: Export /&/ plot in style
#+html_head: <link rel="stylesheet" href="img-slider.css">
* A discussion on contributor support
Concerns [[https://lists.gnu.org/archive/html/emacs-orgmode/2021-04/msg00291.html][were raised]][fn:1] about some contributors' patches languishing, and it not
being made clear how long it might take to get a response from someone.
In [[https://lists.gnu.org/archive/html/emacs-orgmode/2021-04/msg00549.html][response to this]], a the new role of /Contributor Steward/ has been created to:
help ensure contributors get a timely response, help out with preliminary patch
feedback, and keep [[https://updates.orgmode.org/][updates.orgmode.org]] up to date.
Org now has three Contributor Stewards to ease the process for patch submitters
and core maintainers:
- Timothy / TEC
- Tim Cross
- John Corless
If you've been thinking about [[https://orgmode.org/contribute.html][getting involved with Org]], now is a great time to
give it a shot!
#+begin_info
*Ways you can contribute to the project*
Test patches, improve documentation, translate pages, confirm bugs, feedback on a proposed feature, and more...
#+end_info
[fn:1] Disclosure: this is me.
* DOI link exporting
[[https://www.doi.org/][Digital Document Identifiers]] (DOIs) are an ISO-standardised way of robustly
linking to a particular online resource. You'll see these a lot with academic
papers, for example.
Thanks to Nicolas Goaziou, when exporting to HTML, LaTeX, Ascii, and texinfo
DOIs are turned into links, for example https://doi.org/10.18637/jss.v046.i03 becomes:
#+begin_src html
<a href="https://doi.org/10.18637/jss.v046.i03">doi:10.18637/jss.v046.i03</a>
#+end_src
#+begin_src LaTeX
\href{https://doi.org/10.18637/jss.v046.i03}{doi:10.18637/jss.v046.i03}
#+end_src
#+begin_src text
<https://doi.org/10.18637/jss.v046.i03>
#+end_src
#+begin_src texinfo
@uref{https://doi.org/10.18637/jss.v046.i03}
#+end_src
This is a minor change, but I think DOIs are great, so I'm highlighting it.
* Org plot improvements
Over the past month =org-plot.el= has received some attention, my two favourite
changes are:
- You can now call ~org-plot/gnuplot~ with =C-c C-c= on a =#+plot= line _TEC_
- When an image is regenerated, all instances of the image in the buffer are
refreshed _TEC_
Other than a few minor tweaks and bug fixes, that's it for April. However, over
the last year there have been some rather nice improvements that I didn't
mention in the initial blog post, so let's go over them now.
- The inbuilt plot types have been abstracted out into a new structure: ~org-plot/preset-plot-types~.
This means if you have a gnuplot template you find yourself using a lot, you
can now turn it into a custom plot type 😀 _TEC_
- A new plot type has been added: a radar / spider plot _TEC_
- Some new plot keywords have arrived too _TEC_
- =transpose= (=trans=) --- The plot internally does something very similar to =M-x
org-table-transpose-table-at-point= before using the table data.
- =ymin= (=min=), =ymax= (=max=), =xmin=, =xmax= --- Four new keywords (and two
aliases) to set the bounds of a plot. Partially supported by the default types.
- =ticks= --- The number of axis ticks to use along the axis. A good value is
guessed based on a prime factorisation based heuristic (welcome to
improvements).
- Some new customisation functions --- The new variables ~org-plot/gnuplot-script-preamble~, ~org-plot/gnuplot-term-extra~, and ~org-plot/gnuplot-script-preamble~ open up new ways to tweak plots to your
liking. For example, [[https://tecosaur.github.io/emacs-config/config.html#org-plot][I use this]] to set line and background colours based on
my current Emacs theme.
If you haven't used Org plot before, I think it's a great way to quickly
visualise data in a table. To get started, all you need is a =#+plot= line above
the table, with a certain =type= specified (e.g. =type:2d= for a 2d line plot).
Then, if you can specify a certain columns as the independent variable
(x-values) with =ind=, and list dependant variables (y-values) with =deps=.
You can see these parameters set in the figure above,
#+begin_src org
,#+plot: type:2d ind:1 deps:(2 3 4)
| Xval | Red | Blue | Green |
|------+-----+------+-------|
| 0 | 1 | 2 | 3 |
| 1 | 2 | 3 | 4 |
#+end_src
This will call gnuplot and a window showing the plot will appear. If you want to
save the plot to a file, just use the =file= parameter, e.g.
=file:"demoplot.svg"= (note the quotes).
That should get you started, you can see [[https://orgmode.org/manual/Org-Plot.html][the manual]] for the full list of
available keywords and find more examples of usage [[https://orgmode.org/worg/org-tutorials/org-plot.html][on worg]].
* Tweaked ~ox-html~ style
As displays become more high-res, lines of text which span the whole screen
become ... long. So long that it genuinely makes it harder to read the text. A
small tweak to the default style and lines are now capped at =60em= wide and
centred in the page --- much better 🙂. _TEC_
Also, the HTML export now:
- has a slightly nicer source block style
- labels =authinfo= blocks
* A collection of export improvements
- =Verbatim= in headings no longer breaks LaTeX exports _TEC_
- Make the top level class for exported HTML customisable via ~org-html-content-class~ / =#+HTML_CONTENT_CLASS= _Sameer Rahmani_
- Use =<img>= tags for SVGs with =ox-html=, for better behaviour and W3C compliance _TEC_
- Remove redundant ~type="text/javascript"~ from ~<script>~ elements _Bastien Guerry_
- =ox-texinfo= now generates better headlines, menus, and footnotes _Nicolas Goaziou_
- Parsing during exporting no longer aborts as soon as an =#+option= key without
a value is encountered, instead that key is skipped over _Nicolas Goaziou_
- ~org-html-scripts~ and ~org-html-style-default~ have been changed from constants
to configurable values _TEC_
- eval macros =#+macro: ? (eval ...)= are now a little bit faster _Stefan Monnier_
* Miscellaneous changes
- ~org-link-descriptive~ is now buffer-local, to avoid interfering with other buffers _Kyle Meyer_
- =org-colview= no longer chokes when a special property is updated _Nicolas Goaziou_
- Now coderefs have their whitespace cleaned up during tangling _Tom Gillespie_
- Allow for multiple =%(expressions)= in ~org-agenda-prefix-format~ _Ihor Radchenko_
- Code cleanup and refactoring _Nicolas Savage, Aaron L. Zeng, Nicolas Goaziou,
Bastien Guerry, Stefa Monnier, Arne Babenhauserheid_
- Documentation improvements _Jorge Neto, Erik Hetzner, Cheong Yiu Fung, Kyle Meyer_
- New =ob-sqlite= maintainer --- Nick Savage
- Make lilypond header arguments user-configurable _Jamie Bayne_
- Fix =ob-C= regression which mixed up ~int~, ~double~, and ~char*~. Fix another
regression with table parameters _tbanel_
- Fix indentation of list items and new logbook drawer notes _Bastien Guerry_
- Notice when theme changes with LaTeX previews _Yuri Lensky_
- Iron out a few edge cases in =ol.el= (Org links) _Nicolas Goaziou_
- Some new tests for =org-protocol= _Maxim Nikulin_