GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — inkscape_python_figures/plot_meas_impedance.py at main · otvam/inkscape_python_figures

Expand file tree

/

plot_meas_impedance.py

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
74 lines (56 loc) · 2.05 KB
/

plot_meas_impedance.py

Copy path

File metadata and controls

74 lines (56 loc) · 2.05 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
"""
Example for a Matplotlib plot with the impedance measurements.
"""
__author__ = "Thomas Guillod"
__copyright__ = "Thomas Guillod - Dartmouth College"
__license__ = "Mozilla Public License Version 2.0"
import os
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.ticker as tkr
import utils_mpl
# ###########################################################
# Plot global parameters and define dummy data
# ###########################################################
# set global parameters
utils_mpl.set_global()
# create the output folder
os.makedirs("render", exist_ok=True)
# define dummy data
data = np.loadtxt("plot_data/impedance.gz")
# get the axis ticks
xticks = np.power(10.0, np.linspace(3, 8, 6))
yticks = np.power(10.0, np.linspace(0, 5, 6))
# ###########################################################
# Definition of the line plot
# ###########################################################
# create a figure with a determined size
(fig, ax) = utils_mpl.get_fig(size=(3.5, 3.0), dpi=200)
# add reference curves
ax.axvspan(1e3, 4e5, facecolor="green", alpha=0.2)
ax.axvspan(4e5, 1e8, facecolor="orange", alpha=0.2)
ax.plot(data[:, 0], data[:, 1], "r", lw=1.5)
# get the axes transformations
ax.set_xscale("log")
ax.set_yscale("log")
# set the x-axis limit and format
utils_mpl.set_x_axis(ax, bnd=xticks, margin=0.00, log=True)
fmt = tkr.LogFormatterMathtext()
utils_mpl.set_format(ax.xaxis, ticks=xticks, fmt=fmt)
# # set the y-axis limit and format
utils_mpl.set_y_axis(ax, bnd=yticks, margin=0.05, log=True)
fmt = tkr.LogFormatterMathtext()
utils_mpl.set_format(ax.yaxis, ticks=yticks, fmt=fmt)
# set the legend and labels
ax.set_xlabel("Frequency (Hz)")
ax.set_ylabel("Impedance (Ohm)")
ax.set_title("Impedance")
# set the grid
utils_mpl.set_grid(fig, ax, major=True, minor=True)
# save the plot for Inkscape
utils_mpl.save_svg(fig, "render/meas_impedance.svg")
# ###########################################################
# Show the plots
# ###########################################################
# show the plot for inspection
plt.show()
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.