import numpy as np
import matplotlib.pyplot as plt

y1_value = (116, 48, 125)
x_name=('1', '2', '3')
n_groups = len(x_name)
index = np.arange(n_groups)

plt.bar(index, y1_value, color="gray",tick_label=x_name,
        align='center', linewidth=1.5,ec="black", width=0.7, alpha=1)
plt.text(-0.14, 100, "116", fontsize=25, color='#000000')
plt.text(0.9, 35, "48", fontsize=25, color='#000000')
plt.text(1.85, 110, "125", fontsize=25, color='#000000')

ticks = ('HDFS(rdd)', 'HDFS(dataframes)', 'MongoDB')

## x
plt.xticks([0.0, 1.0, 2.0], ticks, fontsize=17)
plt.yticks(fontsize=17)
plt.ylabel('latency (sec)', fontsize=17)
plt.title('Weather Bar Chart')
plt.xlim( -1, n_groups)
#plt.ylim( 0, 400)
plt.show()

 

 

 

import numpy as np
import matplotlib.pyplot as plt
import matplotlib.patches as mpatches
from operator import sub

q = [59, 125]
not_q = [83, 150]

def generate_bar(bar_index, values, bar_color, bar_hatch, bar_alpha):
    plt.bar([bar_index], values, color=bar_color, hatch=bar_hatch, linewidth=1.5,
            ec="black", align='center', width=1, alpha=bar_alpha)
#    if bar_index==2 or bar_index==5:
#        plt.text(bar_index-0.2, values-10, values, fontsize=25, color='#ffffff')
#    else:
    plt.text(bar_index-0.2, values-10, values, fontsize=25, color='#000000')
# Figure
plt.rcParams["figure.figsize"] = (10, 8)

generate_bar(1, q[0], "white", '', 1)
generate_bar(2, not_q[0], "gray", '', 1)

generate_bar(4, q[1], "white", '', 1)
generate_bar(5, not_q[1], "gray", '', 1)


ticks = ('query', 'not query')

## x
plt.xticks([1.5, 4.5], ticks, fontsize=25)
#plt.xlabel('<<<<<GRAPH NAME>>>>>', fontsize=30)

## y
plt.yticks(fontsize=25)
plt.ylabel('latency (sec)', fontsize=30)

## vline
plt.axvline(3)

## legend
q_patch = mpatches.Patch(color='white', ec='black', linewidth=1.5, label='ranged') 
not_q_patch = mpatches.Patch(color='gray', hatch='', ec='black', linewidth=1.5, label='hashed') 
plt.rcParams["legend.fontsize"] = 16
plt.legend(handles=[q_patch, not_q_patch])

ax = plt.gca()
ax.yaxis.grid(alpha=0.3, linestyle='--')

plt.tight_layout()
#plt.savefig("test.pdf", bbox_inches='tight')
plt.show()

 

 

 

import numpy as np
import matplotlib.pyplot as plt
import matplotlib.patches as mpatches
from operator import sub

q = [62, 59]
not_q = [130, 125]

def generate_bar(bar_index, values, bar_color, bar_hatch, bar_alpha):
    plt.bar([bar_index], values, color=bar_color, hatch=bar_hatch, linewidth=1.5,
            ec="black", align='center', width=0.7, alpha=bar_alpha)
#    if bar_index==2 or bar_index==5:
#        plt.text(bar_index-0.2, values-10, values, fontsize=25, color='#ffffff')
#    else:
    plt.text(bar_index-0.2, values-10, values, fontsize=25, color='#000000')
# Figure
plt.rcParams["figure.figsize"] = (10, 8)

generate_bar(1, q[0], "white", '', 1)
generate_bar(2, q[1], "white", '', 1)

generate_bar(4, not_q[0], "gray", '', 1)
generate_bar(5, not_q[1], "gray", '', 1)


ticks = ('{_id:1}','{_id:1, from:1}', '{_id:1}','{_id:1, from:1}')

## x
plt.xticks([1.0, 2.0, 4.0, 5.0], ticks, fontsize=17)
#plt.xlabel('<<<<<GRAPH NAME>>>>>', fontsize=30)

## y
plt.yticks(fontsize=25)
plt.ylabel('latency (sec)', fontsize=30)

## vline
plt.axvline(3)

## legend
q_patch = mpatches.Patch(color='white', ec='black', linewidth=1.5, label='query') 
not_q_patch = mpatches.Patch(color='gray', hatch='', ec='black', linewidth=1.5, label='not query') 
plt.rcParams["legend.fontsize"] = 16
plt.legend(handles=[q_patch, not_q_patch])

ax = plt.gca()
ax.yaxis.grid(alpha=0.3, linestyle='--')

plt.tight_layout()
plt.show()

 

 

 

+ Recent posts