create a new environment conda

Solutions on MaxInterview for create a new environment conda by the best coders in the world

showing results for - "create a new environment conda"
Lotus
07 Sep 2016
1conda create --name myenv
2#Figure([go.Scatter(...), go.Bar(...)])
3
4
5
6# Plotting histogram and figures using a class in Python
7import plotly.graph_objects as go
8from plotly.graph_objs import Figure, Scatter, Bar
9import matplotlib.pyplot as plt
10import plotly.express as px
11
12def plot_data(self):
13        title = f'{self.symbol}: Closing Prices (Start: {self.start} - End: {self.end})'
14        fig = self.plot_whole(data = self.data['price'], title = title, label = self.symbol)
15        fig.show()
16    
17    def plot_whole(self, data, title, label):
18        fig = Figure([
19                go.Scatter(
20                    name = f'{label}',
21                    x = data.index,
22                    y = data.values,
23                    mode = 'lines',
24                    marker = dict(color="#0a0a0a"),
25                    line = dict(width=2),
26                    showlegend = True
27                )
28            ])
29        fig.update_layout(yaxis_title='USD ($)', 
30                          xaxis_title='Timestamp', 
31                          title=f'{title}', 
32                          hovermode="x")
33        return fig
34        
35    def add_plots(self, fig, data, label, color):
36        fig.add_trace(
37                go.Scatter(  
38                    name=f'{label}',
39                    x=data.index,
40                    y=data.values, 
41                    marker = dict(color=f"{color}"),
42                    line = dict(width=2),
43                    mode='lines',                
44                    fillcolor='rgba(68, 68, 68, 0.3)',
45                    showlegend=True
46                )
47            )
48        return fig
49    
50    def add_bar_plots(self, fig, data, label, color):
51        fig.add_trace(
52                go.Bar(  
53                    name=f'{label}',
54                    x=data.index,
55                    y=data.values, 
56                    showlegend = True,
57                    marker = dict(color=f"{color}"), 
58                )
59            )
60        return fig
61    
62    def add_line(self, fig, index, line_pos, label, color):
63        fig.add_trace(
64                go.Scatter(  
65                    name=f'{label}',
66                    x = index,
67                    y = [line_pos]*len(index),
68                    marker = dict(color=f"{color}"), # color picker
69                    line = dict(width=2),
70                    mode='lines',                
71                    fillcolor='rgba(68, 68, 68, 0.3)',
72                    showlegend=True
73                )
74            )
75        return fig
76    
77    def add_signal_plots(self, fig, colname, color): 
78        if not self.data[colname].isnull().all():
79            fig.add_trace(
80                go.Scatter(  
81                    name= f'{colname}',
82                    x = self.data.index,
83                    y = self.data[f'{colname}'],
84                    marker = dict(color=f'{color}'), # color picker
85                    line = dict(width=1),              
86                    mode = "markers", 
87                    fillcolor = 'rgba(68, 68, 68, 0.3)',
88                    showlegend = True
89                )
90            )
91        return fig
92    
93    def plotMACD(self):
94        fig = self.plot_whole(self.data['MACD'], 'MACD', 'MACD Line')
95        nonnegative = self.data['MACD_Histogram'][(self.data['MACD_Histogram']>=0)]
96        negative = self.data['MACD_Histogram'][(self.data['MACD_Histogram']<0)]
97        fig = self.add_bar_plots(fig, nonnegative, 'Non-negative Histogram', "#0a0a0a")
98        fig = self.add_bar_plots(fig, negative, 'Negative Histogram', 'red')
99        self.add_plots(fig, self.data['MACD_Signal'], 'MACD Signal Line', 'red').show()