You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/02-user-guide/examples.md
+26-23Lines changed: 26 additions & 23 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,53 +1,56 @@
1
-
# Examples
1
+
# Guides
2
2
3
3
These examples demonstrate recommended ways of working with `esparto`.
4
-
Note that Jupyter Notebooks do not preserve the formatting of rendered
5
-
content between sessions - be sure to re-run the examples in order to
6
-
view the output as intended.
4
+
5
+
6
+
## Getting Started
7
+
8
+
[](https://colab.research.google.com/github/domvwt/esparto/blob/main/docs/examples/getting-started.ipynb)
A guided tour of the `esparto` API. This notebook covers:
13
+
14
+
* Working with different Content types
15
+
* Layout and formatting
16
+
* Page options
17
+
* Saving your work
18
+
19
+
---
20
+
7
21
8
22
## Data Analysis
9
23
10
24
[](https://colab.research.google.com/github/domvwt/esparto/blob/main/docs/examples/iris-report.ipynb)
[](https://colab.research.google.com/github/domvwt/esparto/blob/main/docs/examples/interactive-plots.ipynb)
Options provided directly to `FigureMpl` will override the global configuration.
31
+
32
+
## PDF Output
33
+
34
+
### From the API
35
+
Saving a page to PDF is achieved through the API by calling the `.save_pdf()`
36
+
method from a `Page` object:
37
+
38
+
```python
39
+
import esparto as es
40
+
41
+
my_page = es.Page(title="My Page")
42
+
my_page +="image.jpg"
43
+
my_page.save_pdf("my-page.pdf)
44
+
```
45
+
46
+
In order to render plots forPDF output, they must be rendered to SVG. While
47
+
this leads to consistent and attractive results for Matplotlib figures, it is
48
+
less predictable and requires additional system configuration for Bokeh and
49
+
Plotly objects.
50
+
51
+
#### Plotly
52
+
The preferred approach with Plotly is to use the Kaleido library, which is installable
53
+
with pip:
54
+
```bash
55
+
pip install kaleido
56
+
```
57
+
Esparto will automatically handle the conversion, provided Kaleido is available.
58
+
59
+
Make sure to inspect results for unusual cropping and other artifacts.
60
+
61
+
#### Bokeh
62
+
The approach taken by Bokeh is to use a browser and webdriver combination.
63
+
I have not been able to make this work during testing but the functionality
64
+
has been retained in esparto should you have more luck with it.
65
+
66
+
See the Bokeh documenation on [additional dependencies for exporting plots.](https://docs.bokeh.org/en/latest/docs/user_guide/export.html#additional-dependencies)
67
+
68
+
Conversion should be handled by esparto, provided the Bokeh dependencies
69
+
are satisfied.
70
+
71
+
### Saving from a Browser
72
+
Alternatively, it is possible to save anyHTML page as a PDF through the print
73
+
menu in your web browser. This method should work withall content types.
0 commit comments