小编Enn*_*ppa的帖子

透明色图

我想得到像这个密度的密度分布图http://www.nicolacarlon.it/out.png 与alpha通道而不是像这个密度的蓝色通道http://www.nicolacarlon.it/out2.png

我发现这个代码,但它不起作用:(

    theCM = cm.get_cmap()
    theCM._init()
    alphas = np.abs(np.linspace(-1.0, 1.0, theCM.N))
    theCM._lut[:-3,-1] = alphas
    plt.imshow(img, cmap=theCM)
    plt.savefig("out.svg", transparent=True)
Run Code Online (Sandbox Code Playgroud)

python numpy matplotlib color-mapping

5
推荐指数
0
解决办法
5906
查看次数

PHP包含html页面charset问题

在使用下面的代码查询mysql数据库后,我生成了一个html文件:

    $myFile = "page.htm";
Run Code Online (Sandbox Code Playgroud)

$ fh = fopen($ myFile,'w')或死("无法打开文件"); fwrite($ fh,$ row ['text']); FCLOSE($ FH);

在msql db上,文本使用utf8_general_ci进行编码.但我需要将它包含在php网页中,如下所示:

 <?include('page.htm');?>
Run Code Online (Sandbox Code Playgroud)

请记住,php网页在标题上使用utf8字符集:

<meta http-equiv="content-type" content="text/html; charset=utf8" />
Run Code Online (Sandbox Code Playgroud)

现在,如果我在数据库上写一些带有重音符号(èàì)或引号字符的字母,我直接打开page.htm并在数据库上看到它看起来一切正常,但是当我在php页面上查看时,我看到了问号 字符而不是我原来想要的字符.为什么?!提前致谢!

php utf-8 diacritics character-encoding

4
推荐指数
2
解决办法
3万
查看次数