Skip to content

Commit

Permalink
Added book.pdf on GitHub since HAL copy is corrupted
Browse files Browse the repository at this point in the history
  • Loading branch information
rougier committed Nov 16, 2021
1 parent 41b790b commit b9dc810
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 7 deletions.
9 changes: 3 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,7 @@ The Python scientific visualisation landscape is huge. It is composed of a myria

### Read the book

You can read the book **[PDF](https://hal.inria.fr/hal-03427242/document)** (95Mo) that is open access and hosted on
[HAL](https://hal.archives-ouvertes.fr/) which is a French open
archive for academics.
Sources for the book (including code examples)
You can read the book **[PDF](pdf/book.pdf)** (95Mo) that is open access and hosted on GitHub. Sources for the book (including code examples)
are available at
[github.com/rougier/scientific-visualization-book](https://github.com/rougier/scientific-visualization-book).

Expand Down Expand Up @@ -46,8 +43,8 @@ future work on Python (and
<img src="images/zorder-plots.png" width="31%"/> <img src="images/scales.png" width="31%"/> <img src="images/histogram-pca.png" width="31%"/>
<img src="images/hatched-bars.png" width="31%"/> <img src="images/platonic-solids.png" width="31%"/> <img src="images/projection-3d-gaussian.png" width="31%"/>
<img src="images/polygon-clipping.png" width="31%"/> <img src="images/multisample.png" width="31%"/> <img src="images/typography-matters.png" width="31%"/>
<img src="images/scatter-3d.png" width="31%"/> <img src="images/waterfall-3d.png" width="31%"/> <img src="https://github.com/rougier/matplotlib-3d/blob/master/doc/bunnies.png" width="31%"/>
<img src="images/polar-projection.png" width="31%"/> <img src="https://raw.githubusercontent.com/rougier/recursive-voronoi/master/recursive-voronoi.png" width="31%"/> <img src="images/text-polar.png" width="31%"/>
<img src="images/scatter-3d.png" width="31%"/> <img src="images/waterfall-3d.png" width="31%"/> <img src="images/bunnies.png" width="31%"/>
<img src="images/polar-projection.png" width="31%"/> <img src="images/recursive-voronoi.png" width="31%"/> <img src="images/text-polar.png" width="31%"/>
<img src="images/spiral-pi.png" width="31%"/> <img src="images/escher.png" width="31%"/> <img src="images/radial-maze.png" width="31%"/>
<img src="images/text-shadow.png" width="95%"/>

Binary file added pdf/book.pdf
Binary file not shown.
2 changes: 1 addition & 1 deletion rst/anatomy.rst
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ In many cases, this can be further compacted using the subplots_ method.
.. code:: python
fig, ax = plt.subplots(figsize=(6,6),
subplot_kw={"aspect"=1})
subplot_kw={"aspect": 1})
ax.plot(range(10))
plt.show()
Expand Down
52 changes: 52 additions & 0 deletions rst2latex.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
#!/usr/bin/env python3

from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals


"""
A customized front end to the Docutils Publisher, producing LaTeX with valid codeblocks using the listings package.
"""

try:
import locale
locale.setlocale(locale.LC_ALL, '')
except:
pass

from docutils.core import publish_cmdline
from docutils.parsers.rst import directives, Directive
from docutils import nodes


class CodeBlock(Directive):
required_arguments = 1
optional_arguments = 0
final_argument_whitespace = False
option_spec = {}
has_content = True

rstlang_to_listingslang = {
'text': '{}'
}

def run(self):
language = self.rstlang_to_listingslang.get(self.arguments[0], self.arguments[0])
content = '\n'.join(self.content)
latex = '\\begin{{lstlisting}}[language={}]\n{}\n\\end{{lstlisting}}'.format(language, content)
return [nodes.raw('', latex, format='latex')]


description = ('Generates LaTeX documents from standalone reStructuredText '
'sources. '
'Reads from <source> (default is stdin) and writes to '
'<destination> (default is stdout). See '
'<http://docutils.sourceforge.net/docs/user/latex.html> for '
'the full reference.')


for directive_name in ('code', 'code-block'):
directives.register_directive(directive_name, CodeBlock)
publish_cmdline(writer_name='latex', description=description)

0 comments on commit b9dc810

Please sign in to comment.