Giter VIP home page Giter VIP logo

git-tutorial's Introduction

import pandas as pd import matplotlib.pyplot as plt from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg as FigureCanvas from PyQt5.QtWidgets import QApplication, QMainWindow, QSizePolicy, QVBoxLayout, QWidget from PyQt5.QtGui import QIcon

class MainWindow(QMainWindow): def init(self): super().init()

    # Load CSV data into a pandas DataFrame
    data = pd.read_csv("test.csv")

    # Extract x and y data from the DataFrame
    x = data["time"]
    y = data["ratio"]

    # Create a figure and a canvas to render the chart in PyQt
    fig = plt.Figure(figsize=(5, 4), dpi=100)
    canvas = FigureCanvas(fig)
    ax = fig.add_subplot(111)

    # Create a line chart with a dashed line style
    ax.plot(x, y, linestyle='--')

    # Add y-axis values to every point
    for i, j in zip(x, y):
        ax.text(i, j, str(j))

    # Add chart title and axis labels
    ax.set_title("Line Chart Title")
    ax.set_xlabel("time")
    ax.set_ylabel("unlock ratio")

    # Create a layout and add the canvas to it
    layout = QVBoxLayout()
    layout.addWidget(canvas)

    # Create a widget and set the layout to it
    widget = QWidget()
    widget.setLayout(layout)

    # Set the central widget of the main window to the widget
    self.setCentralWidget(widget)

    # Set window properties and show the window
    self.setWindowTitle("Line Chart Window Title")
    self.setGeometry(100, 100, 600, 400)
    self.setWindowIcon(QIcon("path/to/icon/file.png"))
    self.show()

if name == "main": app = QApplication([]) window = MainWindow() app.exec_()

git-tutorial's People

Contributors

duxx788 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.