Skip to content

Commit 7b78f91

Browse files
build: add bg-mpl-stylesheet to have better plot (#180)
* build: add bg-mpl-stylesheet to have better plot * [pre-commit.ci] auto fixes from pre-commit hooks * chore: add news item --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent 2a30b00 commit 7b78f91

5 files changed

Lines changed: 40 additions & 13 deletions

File tree

docs/examples/README.rst

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ First, plot the data without performing peak extraction. The first argument
144144
must be either a PDF (as here) or a .srmise file (described later) saved by
145145
SrMise. ::
146146

147-
srmise data/Ag_nyquist_qmax30.gr --no-extract --plot
147+
srmise docs/examples/data/Ag-nyquist-qmax30.gr --no-extract --plot
148148

149149
This should result in an image very similar to the one below. The top shows the
150150
experimental data in blue. The bottom shows the difference curve, which is
@@ -160,7 +160,7 @@ performing peak extraction from around 2 Å to 3.5 Å will be sufficient. To
160160
restrict peak extraction to this interval use the ``--range`` option, which
161161
accepts a pair of values. ::
162162

163-
srmise data/Ag_nyquist_qmax30.gr --no-extract --plot --range 2 3.5
163+
srmise docs/examples/data/Ag-nyquist-qmax30.gr --no-extract --plot --range 2 3.5
164164

165165
The PDF baseline of a crystal is linear, and a reasonable crystal baseline can
166166
often be automatically estimated. To estimate baseline parameters
@@ -170,7 +170,7 @@ baseline for which SrMise provides automatic estimation. Since the results of
170170
peak extraction are conditioned on the baseline parameters, it is a good idea to
171171
see whether they are reasonable. ::
172172

173-
srmise data/Ag_nyquist_qmax30.gr --no-extract --plot --range 2 3.5
173+
srmise docs/examples/data/Ag-nyquist-qmax30.gr --no-extract --plot --range 2 3.5
174174
--baseline "Polynomial(degree=1)"
175175

176176
|images/extract_single_peak2.png|
@@ -179,7 +179,7 @@ The estimated baseline looks reasonable, so it's time to perform peak extraction
179179
By default ``srmise`` performs extraction when run, so simply remove the
180180
``--no-extract`` option. ::
181181

182-
srmise data/Ag_nyquist_qmax30.gr --plot --range 2 3.5
182+
srmise docs/examples/data/Ag-nyquist-qmax30.gr --plot --range 2 3.5
183183
--baseline "Polynomial(degree=1)"
184184

185185
|images/extract_single_peak3.png|
@@ -206,7 +206,7 @@ options.
206206
The script gives results identical to the commands above, and also saves both a
207207
.srmise and .pwa file in the *output* directory. Verify this by running it. ::
208208

209-
python extract_single_peak.py
209+
python extract-single-peak.py
210210

211211

212212
.. ~Example 2~ ..
@@ -236,7 +236,7 @@ which sets SrMise parameters as part of the following pattern: ::
236236

237237
Run and plot the results of this example with ::
238238

239-
python parameter_summary.py
239+
python parameter-summary.py
240240

241241
|images/parameter_summary1.png|
242242

@@ -296,7 +296,7 @@ follows: ::
296296

297297
Run the following command to view this baseline. ::
298298

299-
srmise data/TiO2_fine_qmax26.gr --bpoly1 -0.65 0c --range 0 10
299+
srmise data/TiO2-fine-qmax26.gr --bpoly1 -0.65 0c --range 0 10
300300
--no-extract --plot
301301

302302
|images/parameter_summary2.png|
@@ -634,14 +634,14 @@ First, visually check that the baseline obtained in the earlier silver example
634634
(set using the ``--bsrmise filename.srmise`` option) is reasonable over a
635635
larger range. ::
636636

637-
srmise data/Ag_nyquist_qmax30.gr --no-extract --plot --range 2 10
637+
srmise docs/examples/data/Ag-nyquist-qmax30.gr --no-extract --plot --range 2 10
638638
--bsrmise output/query_results.srmise
639639

640640
|images/query_results1.png|
641641

642642
Next, run ::
643643

644-
python query_results.py
644+
python query-results.py
645645

646646
to perform peak extraction, the example analysis, and obtain the two plots
647647
below.
@@ -764,8 +764,8 @@ Details of the multimodeling procedure are discussed in the comments of the
764764
extraction and analysis scripts. Run these, noting that the extraction script
765765
may take several minutes to complete. ::
766766

767-
python multimodel_known_dG1.py
768-
python multimodel_known_dG2.py
767+
python multimodel-known-dG1.py
768+
python multimodel-known-dG2.py
769769

770770
.. ~Example 6~ ..
771771
@@ -808,8 +808,8 @@ Details of the multimodeling procedure are discussed in the comments of the
808808
extraction and analysis scripts. Run these, noting that the extraction script
809809
may take several minutes to complete. ::
810810

811-
python multimodel_unknown_dG1.py
812-
python multimodel_unknown_dG2.py
811+
python multimodel-unknown-dG1.py
812+
python multimodel-unknown-dG2.py
813813

814814
.. ~PDF Info~ ..
815815

news/bg-mpl-stylesheet.rst

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
**Added:**
2+
3+
* No News Added: Added `bg-mpl-stylesheet` as requirement to render better plot
4+
5+
**Changed:**
6+
7+
* <news item>
8+
9+
**Deprecated:**
10+
11+
* <news item>
12+
13+
**Removed:**
14+
15+
* <news item>
16+
17+
**Fixed:**
18+
19+
* <news item>
20+
21+
**Security:**
22+
23+
* <news item>

requirements/conda.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
numpy
22
scipy
33
matplotlib-base
4+
bg-mpl-stylesheets

requirements/pip.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
numpy
22
scipy
33
matplotlib
4+
bg-mpl-stylesheets

src/diffpy/srmise/applications/plot.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,14 @@
1919
import matplotlib.pyplot as plt
2020
import mpl_toolkits.axisartist as AA
2121
import numpy as np
22+
from bg_mpl_stylesheets.styles import all_styles
2223
from matplotlib.ticker import MultipleLocator
2324
from mpl_toolkits.axes_grid1.inset_locator import inset_axes
2425

2526
from diffpy.srmise.pdfpeakextraction import PDFPeakExtraction, resample
2627
from diffpy.srmise.peakstability import PeakStability
2728

29+
plt.style.use(all_styles["bg-style"])
2830
# For a given figure, returns a label of interest
2931
labeldict = {}
3032

0 commit comments

Comments
 (0)