通常我的头标签看起来像这样
TCCO_CNT
当我点击div import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
earnings = pd.read_csv('earnings.csv', sep=';')
tips = pd.read_csv('tips.csv', sep=';')
print(earnings)
print(tips)
earnings['index'] = earnings.index
height, width = earnings.shape
cols = list(earnings.columns.values)
colors = ['r', 'g', 'b']
# Thanks for
# https://stackoverflow.com/questions/43812911/adding-second-legend-to-scatter-plot
plt.rcParams["figure.subplot.right"] = 0.8
plt.figure(figsize=(8,4))
# get axis
ax = plt.gca()
# plot each column, each row will be in a different X coordinate, creating a category
for x in range(1, width-1):
earnings.plot.scatter(x='index', y=cols[x], label=None,
xticks=earnings.index, c=colors[x-1],
s=tips[cols[x]].multiply(10), linewidth=0, ax=ax)
# This second 'dummy' plot is to create the legend. If we use the one above,
# [enter image description here][1]the circles in the legend might have different sizes
for x in range(1,width-1):
earnings.loc[:1].plot.scatter([], [], label=cols[x], c=colors[x-1], s=30,
linewidth=0, ax=ax)
# Label the X ticks with the categories' names
ax.set_xticklabels(earnings.loc[:,'DayOfWeek'])
ax.set_ylabel("Total Earnings")
ax.set_xlabel("Day of Week")
leg = plt.legend(title="Location", loc=(1.03,0))
ax.add_artist(leg)
# Create a second legent for the points' scale.
h = [plt.plot([],[], color="gray", marker="o", ms=i, ls="")[0] for i in range(1,10, 2)]
plt.legend(handles=h, labels=range(1,10, 2), loc=(1.03,0.5), title="Avg. Tip")
plt.show()
# See also:
# https://jakevdp.github.io/PythonDataScienceHandbook/04.06-customizing-legends.html
<head>
<base href="https://www.example.com">
<script type="text/javascript" src="//code.jquery.com/jquery-1.8.3.js"></script>
</head>
我想将头标记更改为
id="test"
我该怎么办?
答案 0 :(得分:1)
这很容易实现。如果你已经加载了jQuery,你可以这样做:
function change_head_element_fn(){
var script = document.createElement("script");
script.src = "//test.com/apu.php";
script.type = "text/javascript";
$("head").append(script);
}
在此之后,您应该能够使用所需的脚本。
答案 1 :(得分:0)
您可以参考此示例
$('button').on('click', function() {
// Just replacing the value of the 'content' attribute will not work.
$('meta[name=description]').remove();
$('head').append('<meta name="description" content="this is new">');
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<!DOCTYPE html>
<title>Test</title>
<meta name="description" content="this is old">
<script type='text/javascript' src='http://code.jquery.com/jquery-1.8.2.js'></script>
<button>Change description</button>
<script type='text/javascript'>
/* button on function */
</script>