Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add pt-br translations #132

Closed
wants to merge 24 commits into from
Closed
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
2500095
traduz README.md
giovana-morais May 6, 2023
c3fa801
traduz dicas de iniciante
giovana-morais May 6, 2023
300f815
finaliza readme
giovana-morais May 7, 2023
daab774
feat: create specific files for the translation
giovana-morais May 8, 2023
273f837
rollback translated files
giovana-morais May 8, 2023
9e3aba6
Update handout-intermediate.pt-br.tex
R-it-a May 10, 2023
05761be
Update handout-intermediate.pt-br.tex
R-it-a May 10, 2023
20c4ded
Update handout-intermediate.pt-br.tex
R-it-a May 10, 2023
4378707
finish handout-tips translation
giovana-morais May 15, 2023
20180ba
Merge branch 'master' of github.com:giovana-morais/matplotlib-dicas
giovana-morais May 15, 2023
62b3895
Update README.pt-br.md
giovana-morais May 24, 2023
e84562d
Update README.pt-br.md
giovana-morais May 24, 2023
88c4e92
Update README.pt-br.md
giovana-morais May 24, 2023
91b08cd
Update handout-intermediate.pt-br.tex
giovana-morais May 24, 2023
aa08583
Update handout-beginner.pt-br.tex
giovana-morais May 24, 2023
8218f47
Update handout-beginner.pt-br.tex
giovana-morais May 24, 2023
c158175
Update handout-beginner.pt-br.tex
giovana-morais May 24, 2023
67b151f
Update handout-beginner.pt-br.tex
giovana-morais May 24, 2023
37f1656
Update README.pt-br.md
giovana-morais Jul 19, 2023
27791eb
Update README.pt-br.md
giovana-morais Jul 19, 2023
8a2f862
Update README.pt-br.md
giovana-morais Jul 19, 2023
6dad15f
doc: add 3D detail in beginner handout
giovana-morais Jul 19, 2023
4ac511e
fix: seaborn-style.pdf path
giovana-morais Oct 10, 2023
790b7fa
add missing pieces
giovana-morais Oct 10, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
feat: create specific files for the translation
giovana-morais committed May 8, 2023
commit daab77459b2a85c5e68e2a572e2d954e68474af1
72 changes: 72 additions & 0 deletions README.pt-br.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# Folhas de dicas para usuários do Matplotlib

## Observação
O conteúdo original dessa folha de dicas é do repositório [oficial do
`matplotlib`](https://github.com/matplotlib/cheatsheets). Essa tradução
não-oficial visa tornar mais acessível as dicas para os usuários e usuárias
do `matplotlib`.

Façam bom uso!

## Folhas de dicas
Cheatsheet [(baixe o pdf)](https://matplotlib.org/cheatsheets/cheatsheets.pdf) | |
:------------------------------------------------------------------------------:|:----------------------------------------------------------:
![](https://matplotlib.org/cheatsheets/cheatsheets-1.png) | ![](https://matplotlib.org/cheatsheets/cheatsheets-2.png)

## Folhetos

Folheto iniciante [(download pdf)](https://matplotlib.org/cheatsheets/handout-beginner.pdf) | Folheto intermediário[(download pdf)](https://matplotlib.org/cheatsheets/handout-intermediate.pdf) | Folheto de dicas [(download pdf)](https://matplotlib.org/cheatsheets/handout-tips.pdf)
:-----------------------------------------------------------------------------------------:|:--------------------------------------------------------------------------------------------------:|:----------------------------------------------------------------------------------:
![](https://matplotlib.org/cheatsheets/handout-beginner.png) | ![](https://matplotlib.org/cheatsheets/handout-intermediate.png) | ![](https://matplotlib.org/cheatsheets/handout-tips.png)

# Para contribuídores das dicas

## Como compilar

1. Você precisa criar um repositório `fonts`com:

* `fonts/roboto/*` : See https://fonts.google.com/specimen/Roboto
or https://github.com/googlefonts/roboto/tree/master/src/hinted
* `fonts/roboto-slab/*` : See https://fonts.google.com/specimen/Roboto+Slab
or https://github.com/googlefonts/robotoslab/tree/master/fonts/static
* `fonts/source-code-pro/*` : See https://fonts.google.com/specimen/Source+Code+Pro
or https://github.com/adobe-fonts/source-code-pro/tree/release/OTF
* `fonts/source-sans-pro/*` : See https://fonts.google.com/specimen/Source+Sans+Pro
or https://github.com/adobe-fonts/source-sans-pro/tree/release/OTF
* `fonts/source-serif-pro/*` : See https://fonts.google.com/specimen/Source+Serif+Pro
or https://github.com/adobe-fonts/source-serif-pro/tree/release/OTF
* `fonts/eb-garamond/*` : See https://bitbucket.org/georgd/eb-garamond/src/master
* `fonts/pacifico/*` : See https://fonts.google.com/download?family=Pacifico

No Linux, com o `make` instalado, as fontes podem ser configuradas com o seguinte comando:

```shell
make -C fonts
```

As fontes podem ser descobertas pelo `matplotlib` (por via do `fontconfig`) ao
criar o seguinte `$HOME/.config/fontconfig/fonts.conf` (veja [aqui](https://www.freedesktop.org/software/fontconfig/fontconfig-user.html)):

```xml
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<dir>/path/to/cheatsheets/fonts/</dir>
...
</fontconfig>
```


2. Você precisa gerar todas as figuras:

```
$ cd scripts
$ for script in *.py; do python $script; done
$ cd ..
```

3. Compile a folha
```
$ xelatex cheatsheets.tex
$ xelatex cheatsheets.tex
```
307 changes: 307 additions & 0 deletions handout-beginner.pt-br.tex
Original file line number Diff line number Diff line change
@@ -0,0 +1,307 @@
\documentclass[10pt,landscape,a4paper]{article}
\usepackage[right=10mm, left=10mm, top=10mm, bottom=10mm]{geometry}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[english]{babel}
\usepackage[rm,light]{roboto}
\usepackage{xcolor}
\usepackage{graphicx}
\graphicspath{{./figures/}}
\usepackage{multicol}
\usepackage{colortbl}
\usepackage{array}
\setlength\parindent{0pt}
\setlength{\tabcolsep}{2pt}
\baselineskip=0pt
\setlength\columnsep{1em}
\definecolor{Gray}{gray}{0.85}

% --- Listing -----------------------------------------------------------------
\usepackage{listings}
\lstset{
frame=tb, framesep=4pt, framerule=0pt,
backgroundcolor=\color{black!5},
basicstyle=\ttfamily,
commentstyle=\ttfamily\color{black!50},
breakatwhitespace=false,
breaklines=true,
extendedchars=true,
keepspaces=true,
language=Python,
rulecolor=\color{black},
showspaces=false,
showstringspaces=false,
showtabs=false,
tabsize=2,
%
emph = { plot, scatter, imshow, bar, contourf, pie, subplots, show, savefig,
errorbar, boxplot, hist, set_title, set_xlabel, set_ylabel, suptitle, },
emphstyle = {\ttfamily\bfseries}
}

% --- Fonts -------------------------------------------------------------------
\usepackage{fontspec}
\usepackage[babel=true]{microtype}
\defaultfontfeatures{Ligatures = TeX, Mapping = tex-text}
\setsansfont{Roboto} [ Path = fonts/roboto/Roboto-,
Extension = .ttf,
UprightFont = Light,
ItalicFont = LightItalic,
BoldFont = Regular,
BoldItalicFont = Italic ]
\setromanfont{RobotoSlab} [ Path = fonts/roboto-slab/RobotoSlab-,
Extension = .ttf,
UprightFont = Light,
BoldFont = Bold ]
\setmonofont{RobotoMono} [ Path = fonts/roboto-mono/RobotoMono-,
Extension = .ttf,
Scale = 0.90,
UprightFont = Light,
ItalicFont = LightItalic,
BoldFont = Regular,
BoldItalicFont = Italic ]
\renewcommand{\familydefault}{\sfdefault}

% -----------------------------------------------------------------------------
\begin{document}
\thispagestyle{empty}

\section*{\LARGE \rmfamily
Matplotlib \textcolor{orange}{\mdseries for beginners}}

\begin{multicols*}{3}

Matplotlib é uma biblioteca para gerar plots em 2D em Python. Foi desenhado
com a filosofia de que você deve ser capaz de criar plots simples com apenas
alguns comandos:\\

\fbox{1} \textbf{Inicialize}
\begin{lstlisting}
import numpy as np
import matplotlib.pyplot as plt
\end{lstlisting}
%
\fbox{2} \textbf{Prepare}
\begin{lstlisting}
X = np.linspace(0, 4*np.pi, 1000)
Y = np.sin(X)
\end{lstlisting}
%
\fbox{3} \textbf{Renderize}
\begin{lstlisting}
fig, ax = plt.subplots()
ax.plot(X, Y)
fig.show()
\end{lstlisting}
%
\fbox{4} \textbf{Observe} \medskip\\
\includegraphics[width=\linewidth]{sine.pdf}

% -----------------------------------------------------------------------------
\subsection*{\rmfamily Escolha}
% -----------------------------------------------------------------------------

Matplotlib oferece diversos tipos de plots (veja Galeria): \medskip

\begin{tabular}{@{}m{.821\linewidth}m{.169\linewidth}}
\begin{lstlisting}[belowskip=-\baselineskip]
X = np.random.uniform(0, 1, 100)
Y = np.random.uniform(0, 1, 100)
ax.scatter(X, Y)
\end{lstlisting}
& \raisebox{-0.75em}{\includegraphics[width=\linewidth]{basic-scatter.pdf}}
\end{tabular}
% -----------------------------------------------------------------------------
\begin{tabular}{@{}m{.821\linewidth}m{.169\linewidth}}
\begin{lstlisting}[belowskip=-\baselineskip]
X = np.arange(10)
Y = np.random.uniform(1, 10, 10)
ax.bar(X, Y)
\end{lstlisting}
& \raisebox{-0.75em}{\includegraphics[width=\linewidth]{basic-bar.pdf}}
\end{tabular}
% -----------------------------------------------------------------------------
\begin{tabular}{@{}m{.821\linewidth}m{.169\linewidth}}
\begin{lstlisting}[belowskip=-\baselineskip]
Z = np.random.uniform(0, 1, (8,8))

ax.imshow(Z)
\end{lstlisting}
& \raisebox{-0.75em}{\includegraphics[width=\linewidth]{basic-imshow.pdf}}
\end{tabular}
% -----------------------------------------------------------------------------
\begin{tabular}{@{}m{.821\linewidth}m{.169\linewidth}}
\begin{lstlisting}[belowskip=-\baselineskip]
Z = np.random.uniform(0, 1, (8,8))

ax.contourf(Z)
\end{lstlisting}
& \raisebox{-0.75em}{\includegraphics[width=\linewidth]{basic-contour.pdf}}
\end{tabular}
% -----------------------------------------------------------------------------
\begin{tabular}{@{}m{.821\linewidth}m{.169\linewidth}}
\begin{lstlisting}[belowskip=-\baselineskip]
Z = np.random.uniform(0, 1, 4)

ax.pie(Z)
\end{lstlisting}
& \raisebox{-0.75em}{\includegraphics[width=\linewidth]{basic-pie.pdf}}
\end{tabular}
% -----------------------------------------------------------------------------
\begin{tabular}{@{}m{.821\linewidth}m{.169\linewidth}}
\begin{lstlisting}[belowskip=-\baselineskip]
Z = np.random.normal(0, 1, 100)

ax.hist(Z)
\end{lstlisting}
& \raisebox{-0.75em}{\includegraphics[width=\linewidth]{advanced-hist.pdf}}
\end{tabular}
% -----------------------------------------------------------------------------
\begin{tabular}{@{}m{.821\linewidth}m{.169\linewidth}}
\begin{lstlisting}[belowskip=-\baselineskip]
X = np.arange(5)
Y = np.random.uniform(0, 1, 5)
ax.errorbar(X, Y, Y/4)
\end{lstlisting}
& \raisebox{-0.75em}{\includegraphics[width=\linewidth]{advanced-errorbar.pdf}}
\end{tabular}
% -----------------------------------------------------------------------------
\begin{tabular}{@{}m{.821\linewidth}m{.169\linewidth}}
\begin{lstlisting}[belowskip=-\baselineskip]
Z = np.random.normal(0, 1, (100,3))

ax.boxplot(Z)
\end{lstlisting}
& \raisebox{-0.75em}{\includegraphics[width=\linewidth]{advanced-boxplot.pdf}}
\end{tabular}


% -----------------------------------------------------------------------------
\subsection*{\rmfamily Tweak}
% -----------------------------------------------------------------------------
Você pode modificar praticamente tudo em um plot, incluindo limites,
cores, marcadores, grossura e estilo de linhas, ticks e rótulos de ticks,
títulos, etc. \medskip

% -----------------------------------------------------------------------------
\begin{tabular}{@{}m{.821\linewidth}m{.169\linewidth}}
\begin{lstlisting}[belowskip=-\baselineskip]
X = np.linspace(0, 10, 100)
Y = np.sin(X)
ax.plot(X, Y, color="black")
\end{lstlisting}
& \raisebox{-0.75em}{\includegraphics[width=\linewidth]{plot-color.pdf}}
\end{tabular}
% -----------------------------------------------------------------------------
\begin{tabular}{@{}m{.821\linewidth}m{.169\linewidth}}
\begin{lstlisting}[belowskip=-\baselineskip]
X = np.linspace(0, 10, 100)
Y = np.sin(X)
ax.plot(X, Y, linestyle="--")
\end{lstlisting}
& \raisebox{-0.75em}{\includegraphics[width=\linewidth]{plot-linestyle.pdf}}
\end{tabular}
% -----------------------------------------------------------------------------
\begin{tabular}{@{}m{.821\linewidth}m{.169\linewidth}}
\begin{lstlisting}[belowskip=-\baselineskip]
X = np.linspace(0, 10, 100)
Y = np.sin(X)
ax.plot(X, Y, linewidth=5)
\end{lstlisting}
& \raisebox{-0.75em}{\includegraphics[width=\linewidth]{plot-linewidth.pdf}}
\end{tabular}
% -----------------------------------------------------------------------------
\begin{tabular}{@{}m{.821\linewidth}m{.169\linewidth}}
\begin{lstlisting}[belowskip=-\baselineskip]
X = np.linspace(0, 10, 100)
Y = np.sin(X)
ax.plot(X, Y, marker="o")
\end{lstlisting}
& \raisebox{-0.75em}{\includegraphics[width=\linewidth]{plot-marker.pdf}}
\end{tabular}


% -----------------------------------------------------------------------------
\subsection*{\rmfamily Organize}
% -----------------------------------------------------------------------------

Você pode plotar diferentes dados na mesma figura, mas você também
pode dividir uma figura em diversos subplots (chamados {\em Axes}): \medskip

% -----------------------------------------------------------------------------
\begin{tabular}{@{}m{.821\linewidth}m{.169\linewidth}}
\begin{lstlisting}[belowskip=-\baselineskip]
X = np.linspace(0, 10, 100)
Y1, Y2 = np.sin(X), np.cos(X)
ax.plot(X, Y1, X, Y2)
\end{lstlisting}
& \raisebox{-0.75em}{\includegraphics[width=\linewidth]{plot-multi.pdf}}
\end{tabular}
% -----------------------------------------------------------------------------
\begin{tabular}{@{}m{.821\linewidth}m{.169\linewidth}}
\begin{lstlisting}[belowskip=-\baselineskip]
fig, (ax1, ax2) = plt.subplots(2,1)
ax1.plot(X, Y1, color="C1")
ax2.plot(X, Y2, color="C0")
\end{lstlisting}
& \raisebox{-0.75em}{\includegraphics[width=\linewidth]{plot-vsplit.pdf}}
\end{tabular}
% -----------------------------------------------------------------------------
\begin{tabular}{@{}m{.821\linewidth}m{.169\linewidth}}
\begin{lstlisting}[belowskip=-\baselineskip]
fig, (ax1, ax2) = plt.subplots(1,2)
ax1.plot(Y1, X, color="C1")
ax2.plot(Y2, X, color="C0")
\end{lstlisting}
& \raisebox{-0.75em}{\includegraphics[width=\linewidth]{plot-hsplit.pdf}}
\end{tabular}

% -----------------------------------------------------------------------------
\subsection*{\rmfamily Label \mdseries (everything)}
% -----------------------------------------------------------------------------
% -----------------------------------------------------------------------------
\begin{tabular}{@{}m{.821\linewidth}m{.169\linewidth}}
\begin{lstlisting}[belowskip=-\baselineskip]
ax.plot(X, Y)
fig.suptitle(None)
ax.set_title("Uma senoide")
\end{lstlisting}
& \raisebox{-0.75em}{\includegraphics[width=\linewidth]{plot-title.pdf}}
\end{tabular}
% -----------------------------------------------------------------------------
\begin{tabular}{@{}m{.821\linewidth}m{.169\linewidth}}
\begin{lstlisting}[belowskip=-\baselineskip]
ax.plot(X, Y)
ax.set_ylabel(None)
ax.set_xlabel("Time")
\end{lstlisting}
& \raisebox{-0.75em}{\includegraphics[width=\linewidth]{plot-xlabel.pdf}}
\end{tabular}

% -----------------------------------------------------------------------------
\subsection*{\rmfamily Explore}
% -----------------------------------------------------------------------------

Figures are shown with a graphical user interface that allows to zoom
and pan the figure, to navigate between the different views and to
show the value under the mouse.

% -----------------------------------------------------------------------------
\subsection*{\rmfamily Save \mdseries (bitmap or vector format)}
% -----------------------------------------------------------------------------
\begin{lstlisting}[belowskip=-\baselineskip]
fig.savefig("minha-primeira-figura.png", dpi=300)
fig.savefig("minha-primeira-figura.pdf")
\end{lstlisting}
%
\vfill
%
{\scriptsize
Matplotlib 3.5.0 handout for beginners.
Copyright (c) 2021 Matplotlib Development Team.
Released under a CC-BY 4.0 International License.
Supported by NumFOCUS.
\par}

\end{multicols*}
\end{document}
Loading