python
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| python [2020/01/03 12:40] – admin | python [2021/05/06 11:15] (current) – admin | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ### Plot (matplotlib) | + | ## Data Type |
| - | py37-matplotlib has the following notes: | + | |
| - | The default backend is the interactive Mac OS X backend. Different backends can be specified using the | + | |
| - | ~/ | + | |
| - | + | ||
| - | https:// | + | |
| - | | + | |
| - | ### Common Error | + | ^ Example |
| + | | x = "Hello World" | ||
| + | | x = 20 | int | | ||
| + | | x = 20.5 | float | | ||
| + | | x = 1j | complex | ||
| + | | x = [" | ||
| + | | x = (" | ||
| + | | x = range(6) | ||
| + | | x = {" | ||
| + | | x = {" | ||
| + | | x = frozenset({" | ||
| + | | x = True | bool | | ||
| + | | x = b" | ||
| + | | x = bytearray(5) | ||
| + | | x = memoryview(bytes(5)) | ||
| + | |||
| + | ref: https:// | ||
| + | |||
| + | ### Class | ||
| + | ref: | ||
| + | |||
| + | ## Create a list of objects from a class | ||
| + | ```python | ||
| + | | ||
| + | | ||
| + | # Swatch is the name of the class | ||
| + | ``` | ||
| + | <wrap lo> | ||
| + | Reference: | ||
| + | - [[https:// | ||
| + | </ | ||
| + | |||
| + | ## Format Variables | ||
| + | ```python | ||
| + | | ||
| + | | ||
| + | | ||
| + | # f:float, x:hex, s:string | ||
| + | ``` | ||
| + | The three lines above give the same result ````hue = 220.00````.\\ | ||
| + | The first line is the old way, " | ||
| + | |||
| + | <wrap lo> | ||
| + | Reference: | ||
| + | - Using % and .format() for great good!: https:// | ||
| + | </ | ||
| + | |||
| + | |||
| + | ## Plot (matplotlib) | ||
| + | py37-matplotlib has the following notes:\\ | ||
| + | The default backend is the interactive Mac OS X backend. Different backends can be specified using the | ||
| + | ~/ | ||
| + | https:// | ||
| + | |||
| + | ```python | ||
| + | import matplotlib.pyplot as plt | ||
| + | plt.plot(x, y, color=' | ||
| + | ``` | ||
| + | |||
| + | Note: ```markerfacecolor``` accept RGB, HEX and simple color text description: | ||
| + | |||
| + | ### 3D plot: | ||
| + | https:// | ||
| + | |||
| + | ## Common Error | ||
| + | ```python | ||
| File " | File " | ||
| self.sat = (cMax - cMin)/ | self.sat = (cMax - cMin)/ | ||
| ^ | ^ | ||
| TabError: inconsistent use of tabs and spaces in indentation | TabError: inconsistent use of tabs and spaces in indentation | ||
| + | ``` | ||
| {{ :: | {{ :: | ||
| Convert all tab to space will solve this problem. | Convert all tab to space will solve this problem. | ||
python.1578026410.txt.gz · Last modified: (external edit)
