|
1338 | 1338 | "source": [ |
1339 | 1339 | "try:\n", |
1340 | 1340 | " import scienceplots\n", |
1341 | | - " with plt.style.context('science'):\n", |
| 1341 | + " with plt.style.context(['science', 'no-latex']): # if you have LaTeX installed, remove 'no-latex'\n", |
1342 | 1342 | " dss.Text.Command = 'plot circuit c1=red'\n", |
1343 | 1343 | "except:\n", |
1344 | 1344 | " # let's ignore if the user didn´t install SciencePlots\n", |
1345 | 1345 | " pass" |
1346 | 1346 | ] |
1347 | 1347 | }, |
| 1348 | + { |
| 1349 | + "cell_type": "markdown", |
| 1350 | + "id": "03aa7d32", |
| 1351 | + "metadata": {}, |
| 1352 | + "source": [ |
| 1353 | + "### Adjusting specific elements\n", |
| 1354 | + "\n", |
| 1355 | + "If using a style is not desired, users can adjust specific elements. [`rc_context`](https://matplotlib.org/stable/api/matplotlib_configuration_api.html#matplotlib.rc_context) is a way to control the elements temporarily, while [`rcParams`](https://matplotlib.org/stable/api/matplotlib_configuration_api.html#matplotlib.rcParams) allow changing the params for the current session." |
| 1356 | + ] |
| 1357 | + }, |
| 1358 | + { |
| 1359 | + "cell_type": "code", |
| 1360 | + "execution_count": null, |
| 1361 | + "id": "9921c23f", |
| 1362 | + "metadata": {}, |
| 1363 | + "outputs": [], |
| 1364 | + "source": [ |
| 1365 | + "from matplotlib import rc_context\n", |
| 1366 | + "\n", |
| 1367 | + "with rc_context({\n", |
| 1368 | + " 'font.size': 8,\n", |
| 1369 | + " 'font.family': 'Serif',\n", |
| 1370 | + " 'font.weight': 'bold',\n", |
| 1371 | + " 'scatter.marker': 's',\n", |
| 1372 | + " 'lines.markersize': 10,\n", |
| 1373 | + " 'image.cmap': 'rainbow',\n", |
| 1374 | + "}):\n", |
| 1375 | + " dss('plot scatter')" |
| 1376 | + ] |
| 1377 | + }, |
1348 | 1378 | { |
1349 | 1379 | "attachments": {}, |
1350 | 1380 | "cell_type": "markdown", |
|
1485 | 1515 | "name": "python", |
1486 | 1516 | "nbconvert_exporter": "python", |
1487 | 1517 | "pygments_lexer": "ipython3", |
1488 | | - "version": "3.10.10" |
| 1518 | + "version": "3.12.2" |
1489 | 1519 | } |
1490 | 1520 | }, |
1491 | 1521 | "nbformat": 4, |
|
0 commit comments