Skip to content

Some python scripts for drawing figures in scientific papers

Notifications You must be signed in to change notification settings

martin6336/DrawFigureForPaper

Repository files navigation

DrawFigureForPaper

This repo stores some python scripts for drawing figures in scientific papers, i.e., "Microblog Hashtag Generation via Encoding Conversation Contexts " and "Topic-Aware Neural Keyphrase Generation for Social Media Language".

Here I do not intend to give detailed tutorials on how to draw figures using python, but just share some examples, including heatmap, histogram with error bar, and line figure. This repo will be kept updating hopefully:)

Dependencies

  • Python 3.6
  • matplotlib
  • pickle
  • numpy

Heatmap

Heatmap is a kind of common figures for visualizing attention scores. There are three inputs for drawing one heatmap, including column labels, row labels, and the weights to decide the darkness of color in each grid. Here I give two examples below: (plotted by heatmap.py and double_heatmap.py respectively)

blue heatmap

As the attention weights may be in large size, you can dump it in the format of csv (e.g., bi_attn.csv) and read it as input in the program heatmap.py later.

red heatmap

Histogram

Histogram with error bar is a very good choice for demonstrating your model performance. Here I give two examples: (plotted by hist_error_bar.py and frequency_hist.py respectively). Acknowledge Wang Chen for his help.

double vertical histogram with error bar

The error bar is computed by the standard deviation of your multiple model evaluation results. It is fed into the yerr argument of the method matplotlib.pyplot.bar().

double horizontal histogram

Line Figure

Here I show two examples on line figures: (plotted by dist_line.py and absent_rate_lines.py respectively)

line figure for distributions

You can first prepare the data statistics in the a collections python object and dump them as pickle object, e.g., tw_seg_data.pickle and wb_seg_data.pickle. dist_line.py reads these pickle data as input and compute its distribution for each bin.

lline figure for absent rates

About

Some python scripts for drawing figures in scientific papers

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages