保证最后一个滴答声matplotlib

时间:2018-11-26 15:27:55

标签: python matplotlib

我有一个具有7个子图的图,看起来像下面的图,都在y轴上具有持续时间,但是比例不同(由matplotlib选择)。为了提高可读性,是否可以通过至少再增加一个轴刻度来避免数据点中断?我不想对缩放进行手动控制。

cut-off-datapoints

此图的相关源代码为:

import time
import csv
from selenium import webdriver
import selenium.webdriver.chrome.service as service
import requests
from bs4 import BeautifulSoup

all_product = []

urls = ["https://www.vatainc.com/infusion.html?limit=all", "https://www.vatainc.com/wound-care.html"]
service = service.Service('/Users/Jonathan/Downloads/chromedriver.exe')
service.start()
capabilities = {'chrome.binary': '/Google/Chrome/Application/chrome.exe'}
driver = webdriver.Remote(service.service_url, capabilities)
for index, url in enumerate(urls):
    driver.get(url)
    time.sleep(2)
    links = [x.get_attribute('href') for x in driver.find_elements_by_xpath("//*[contains(@class, 'product-name')]/a")]



for link in links:
    html = requests.get(link).text
    soup = BeautifulSoup(html, "html.parser")
    products = soup.findAll("div", {"class": "product-view"})
    print(links)

1 个答案:

答案 0 :(得分:0)

您可以使用ylim,例如查看this example