import os from bibliobanana import compute_yearly_citations, load_results_from_file, \ plot_yearly_count search_term = "increased interest" start_date = 1964 end_date = 2020 save_file = "{}_{}-{}".format(search_term, start_date, end_date) # Get the results from PubMed. if not os.path.isfile(save_file + ".csv"): result_dict = compute_yearly_citations(search_term, start_date, end_date, \ comparison_terms="banana", database="pubmed", pause=0.5, verbose=True, \ save_to_file=save_file+".csv", plot_to_file=None) # Load the results from a local file. else: result_dict = load_results_from_file(save_file + ".csv") # Plot the results. fig, ax = plot_yearly_count(result_dict, plot_ratio=False, \ plot_average_comparison=False, scale_to_max=False, \ figsize=(8.0,6.0), dpi=600.0) fig.savefig(save_file + ".png")
"Thyroid Neoplasms", \ ] # Define the comperison terms. comparison_terms = ["Endocrine Gland Neoplasms"] # Define the search range. start_date = 1945 end_date = 2019 # Construct the name of the file to which we should save the data. save_file = "MeSH-neoplasms_{}-{}".format(start_date, end_date) # Get the results from PubMed. if not os.path.isfile(save_file+".csv"): print("Getting data from PubMed...") result = compute_yearly_citations(search_terms, start_date, end_date, \ comparison_terms=comparison_terms, database="pubmed", \ pubmed_field="mesh", exact_phrase=True, pause=0.5, verbose=True, \ save_to_file=save_file+".csv", plot_to_file=None) # Load from an existing file. else: print("Loading data from file...") result = load_results_from_file(save_file+".csv") print("Plotting results...") # Plot the results. fig, ax = plot_yearly_count(result, plot_ratio=False, \ plot_average_comparison=False, scale_to_max=False, \ figsize=(8.0,6.0), dpi=600.0) fig.savefig(save_file+".png") # Plot the results as ratios of the comparison terms.