Skip to content

Commit

Permalink
Added missing dependencies and removed plotly version lock
Browse files Browse the repository at this point in the history
  • Loading branch information
msalem99 committed Mar 7, 2023
1 parent c98e713 commit bd6c4c6
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions docs/Maths.md
Original file line number Diff line number Diff line change
Expand Up @@ -238,19 +238,19 @@ img = Image.fromarray(np.asarray(canvas.buffer_rgba()))
Before running this example, please install the required dependencies using the command below:

```
pip install fpdf2 plotly==5.13.1 kaleido numpy
pip install fpdf2 plotly kaleido numpy
```

[kaleido](https://pypi.org/project/kaleido/) is a cross-platform library for generating static images that is used by plotly.

Example taken from [Plotly static image export tutorial](https://plotly.com/python/static-image-export/):

```python
import io
import plotly.graph_objects as go
import numpy as np
from fpdf import FPDF
from PIL import Image
import io


np.random.seed(1)

Expand Down Expand Up @@ -287,17 +287,17 @@ Result:

![](plotly_png.png)

You can also embed a figure as [SVG](SVG.md) but this is not recommended because the text data such as the x and y axis bars might not show as illustrated in the result image because plotly places this data in a svg text tag which is currently not supported by FPDF2.
You can also embed a figure as [SVG](SVG.md) but this is not recommended because the text data such as the x and y axis bars might not show as illustrated in the result image because plotly places this data in a svg text tag which is currently [not supported](https://github.com/PyFPDF/fpdf2/issues/537) by FPDF2.

Before running this example, please install the required dependencies:

```
pip install fpdf2 pandas
pip install fpdf2 plotly kaleido pandas
```

```python
import plotly.graph_objects as go
from fpdf import FPDF
import plotly.graph_objects as go
import plotly.express as px

fig = px.bar(x=["a", "b", "c"], y=[1, 3, 2])
Expand Down

0 comments on commit bd6c4c6

Please sign in to comment.