Answers for "create an environment conda"

50

conda create environment

conda create -n myenv python=3.6
Posted by: Guest on October-01-2020
0

Create a new environment - Conda

conda create --name myenv
#Figure([go.Scatter(...), go.Bar(...)])



# Plotting histogram and figures using a class in Python
import plotly.graph_objects as go
from plotly.graph_objs import Figure, Scatter, Bar
import matplotlib.pyplot as plt
import plotly.express as px

def plot_data(self):
        title = f'{self.symbol}: Closing Prices (Start: {self.start} - End: {self.end})'
        fig = self.plot_whole(data = self.data['price'], title = title, label = self.symbol)
        fig.show()
    
    def plot_whole(self, data, title, label):
        fig = Figure([
                go.Scatter(
                    name = f'{label}',
                    x = data.index,
                    y = data.values,
                    mode = 'lines',
                    marker = dict(color="#0a0a0a"),
                    line = dict(width=2),
                    showlegend = True
                )
            ])
        fig.update_layout(yaxis_title='USD ($)', 
                          xaxis_title='Timestamp', 
                          title=f'{title}', 
                          hovermode="x")
        return fig
        
    def add_plots(self, fig, data, label, color):
        fig.add_trace(
                go.Scatter(  
                    name=f'{label}',
                    x=data.index,
                    y=data.values, 
                    marker = dict(color=f"{color}"),
                    line = dict(width=2),
                    mode='lines',                
                    fillcolor='rgba(68, 68, 68, 0.3)',
                    showlegend=True
                )
            )
        return fig
    
    def add_bar_plots(self, fig, data, label, color):
        fig.add_trace(
                go.Bar(  
                    name=f'{label}',
                    x=data.index,
                    y=data.values, 
                    showlegend = True,
                    marker = dict(color=f"{color}"), 
                )
            )
        return fig
    
    def add_line(self, fig, index, line_pos, label, color):
        fig.add_trace(
                go.Scatter(  
                    name=f'{label}',
                    x = index,
                    y = [line_pos]*len(index),
                    marker = dict(color=f"{color}"), # color picker
                    line = dict(width=2),
                    mode='lines',                
                    fillcolor='rgba(68, 68, 68, 0.3)',
                    showlegend=True
                )
            )
        return fig
    
    def add_signal_plots(self, fig, colname, color): 
        if not self.data[colname].isnull().all():
            fig.add_trace(
                go.Scatter(  
                    name= f'{colname}',
                    x = self.data.index,
                    y = self.data[f'{colname}'],
                    marker = dict(color=f'{color}'), # color picker
                    line = dict(width=1),              
                    mode = "markers", 
                    fillcolor = 'rgba(68, 68, 68, 0.3)',
                    showlegend = True
                )
            )
        return fig
    
    def plotMACD(self):
        fig = self.plot_whole(self.data['MACD'], 'MACD', 'MACD Line')
        nonnegative = self.data['MACD_Histogram'][(self.data['MACD_Histogram']>=0)]
        negative = self.data['MACD_Histogram'][(self.data['MACD_Histogram']<0)]
        fig = self.add_bar_plots(fig, nonnegative, 'Non-negative Histogram', "#0a0a0a")
        fig = self.add_bar_plots(fig, negative, 'Negative Histogram', 'red')
        self.add_plots(fig, self.data['MACD_Signal'], 'MACD Signal Line', 'red').show()
Posted by: Guest on June-16-2021

Code answers related to "create an environment conda"

Python Answers by Framework

Browse Popular Code Answers by Language