#python, printing alpha beta and theta symbols
# i want to be able to put an alpha beta and theta symbol in
this graph using python
import numpy as np
import matplotlib.pyplot as plt
a = np.linspace(0,50,50)
b=[]
for i in a:
b.append(np.sin(i))
plt.plot(a,b)
####################################
#### problem is just below #####
####################################
plt.xlabel('$\Theta$ (lol)')
plt.ylabel('$\Alpha$ (lol)')
plt.title('$\Beta$ (lol)')
plt.show()
Please let me know if you require any further assistance.
You have the right idea and we can put almost any mathematical symbols in python using this method->
r'$\theta$' # Use the 'r' tag and put any mathematical expression inside the '$' tags. use '\' backward slash before the name of any symbol.
So your final solution will be like this :
import matplotlib.pylab as plt
import numpy as np
a = np.linspace(0, 50, 50)
b=[]
for i in x:
b.append(np.sin(i))
plt.plot(a,b)
plt.xlabel(r'$\theta$')
plt.ylabel(r'$\alpha$')
plt.title(r'$\beta$')
plt.show()
You will get your solution as shown in the picture
below
:
#python, printing alpha beta and theta symbols # i want to be able to put an...
# python graph # i want to add a caption below this graph import matplotlib.pyplot as plt import numpy as np import math #pylab inline from mpl_toolkits.mplot3d import Axes3D a = np.linspace(50,200,50) b = np.linspace(500,2000,50) c = np.linspace(5,20,50) plt.axes(projection='3d') for i in c: plt.plot(a,b,i) plt.title("title) plt.yaxis("y axis ") txt = "this is a graph of a bunch of lines" #cant get this to work plt.text(0.5, 0.05,0.7,0.1, txt, ha='center') ##cant get this to work plt.set_size_inches(7, 8,6, forward=True) #cant get this to...
using python Type: pip3 install matplotlib This installs the matplotlib and you should be able to run the code listed below in line_graph_example.py. The original x_coords list had n+1 entries where n = 4. Make a new x_coords list have 2*n +1 elements [0, 1, ..., 2*n] and augment the y_coords by adding (using insert) a new value between any two old elements. The new value should be the (average of neighbors +1). Then plot the new data. Line graph...
Python, I need help with glob. I have a lot of data text files and want to order them. However glob makes it in the wrong order. Have: data00120.txt data00022.txt data00045.txt etc Want: data00000.txt data00001.txt data00002.txt etc Code piece: def last_9chars(x): return(x[-9:]) files = sorted(glob.glob('data*.txt'),key = last_9chars) whole code: import numpy as np import matplotlib.pyplot as plt import glob import sys import re from prettytable import PrettyTable def last_9chars(x): return(x[-9:]) files = sorted(glob.glob('data*.txt'),key = last_9chars) x = PrettyTable() x.field_names =...
python / visual studio
Problem 1: Random Walk A random walk is a stochastic process. A stochastic process is a series of values that are not determined functionally, but probabilistically. The random walk is supposed to describe an inebriated person who, starting from the bar, intends to walk home, but because of intoxication instead randomly takes single steps either forward or backward, left or right. The person has no memory of any steps taken, so theoretically, the person shouldn't move...
python / visual studio
Problem 1: Random Walk A random walk is a stochastic process. A stochastic process is a series of values that are not determined functionally, but probabilistically. The random walk is supposed to describe an inebriated person who, starting from the bar, intends to walk home, but because of intoxication instead randomly takes single steps either forward or backward, left or right. The person has no memory of any steps taken, so theoretically, the person shouldn't move...
python
1
import matplotlib.pyplot as plt
2
import numpy as np
3
4
abscissa = np.arange(20)
5
plt.gca().set_prop_cycle(
’
color
’
, [
’
red
’
,
’
green
’
,
’
blue
’
,
’
black
’
])
6
7
class MyLine:
8
9
def __init__(self,
*
args,
**
options):
10
#TO DO: IMPLEMENT FUNCTION
11
pass
12
13
def draw(self):
14
plt.plot(abscissa,self.line(abscissa))
15
16
def get_line(self):
17
return "y = {0:.2f}x + {1:.2f}".format(self.slope,
self.intercept)
18
19
def __str__(self):...
Python, given a code in class i just need help with the third
bullet point ; using a and n (defined in the second picture of
python code) find the first digit for k! for k =1,...,n. you dont
have to type in all this code just help me write the code in the
first picture where it says: def benford(a):
b = [0 for d in range(1,10)]
#Do everthything in here
return b
2.2 Generating data In this assignment...
My tests for sorting algorithms are not working. sorting.py has 6 sorting algorithms and test_sorting.py has test cases to run those algorithms, but test cases are not working. please correct the errors in test_sorting.py file so that it can test all the sorting algorithms. WARNING: DON'T COPY AND PASTE THE QUESTION IN ANSWER. I WILL REPORT YOU. sorting.py # 1. selection sort # 2. insertion sort # 3. shell sort # 4. heap sort # 5. merge sort # 6....
this is my code to predict a housing price based on data but i
get a lot errors, how do i resolve all these errors
9]: import seaborn as sns from sklearn.linear model import LinearRegression 20]: import numpy as np import matplotlib.pyplot as plt %matplotlib inline import pandas as pd data- pd.read_csv('C:\\Users \\Downloads \\house-prices -advanced-regression-techniques\\test.csv) I data 20]: ScreenPorch PoolArea PoolQC Fence Id MSSubClass MSZoning LotFrontage LotArea Street Alley LotShape LandContour Utilities NaN MnPry 120 Lvl AlPub Pave NaN Reg...