makeGraph
Cal's Custom makeGraph Python Lib
Example
#This is an example of drawing 4 plots by generating them
graphData = {
"figTitle": "Simple Plot",
"figTitleFontSize": 16,
"figSize": (8,8), #Yay America, this is in inches :/ # Note: cm = 1/2.54
"xLabel": "x label",
"yLabel": "y label",
"plotDim": (2,2),
"subPlots":[]
}
#Create 4 identical plots with different names
for i in range(4):
newPlot = {
"title": f"Graph {i+1}",
"noLedg": i % 2 == 0,
"plots": [
{"x":[0,1,2,3,4], "y":[0,1,2,3,4], "label":"Linear"},
{"x":[0,1,2,3,4], "y":[5,5,5,5,5]},
{"x":[4,3,2,1,0], "y":[4,3,2,1,0], "label":"Linear2"},
{"x":0, "type":"axvLine", "label":"Red Vertical Line", "color":"uq:red"},
{"y":6, "type":"axhLine", "label":"Dashed Horizontal Line", "args":{"linestyle":"--"}},
{"type":"point", "x":4, "y":4, "label":"A Random Point", "colour":"uq:purple"},
{
"x":np.arange(0, 4, 0.1), "y": 3*np.sin(np.arange(0, 4, 0.1)),
"colour":"uq:dark_grey", "maxPoint": True,
"minPoint": "Custom Min {x:.1f}, {y:.1f}",
"fill": {"color": UQ_COLOURS["green"].alpha_adj(0.07)}
}
]
}
graphData["subPlots"].append(newPlot)
makeGraph(graphData)
Languages
Python
100%